From 9ee0c72cdfed6b223385282ffa799e41478ae2ec Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Tue, 17 Sep 2024 19:20:54 -0400 Subject: [PATCH] Remove 2.0 built file --- docs/data.json | 337147 ---------------------------------------------- 1 file changed, 337147 deletions(-) delete mode 100644 docs/data.json diff --git a/docs/data.json b/docs/data.json deleted file mode 100644 index 23108f9df1..0000000000 --- a/docs/data.json +++ /dev/null @@ -1,337147 +0,0 @@ -[ - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Environment" - }, - { - "title": "submodule", - "description": "Environment", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 85 - } - }, - "context": { - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 87 - }, - "end": { - "line": 8, - "column": 30, - "index": 117 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/accessibility/color_namer.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Environment", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Environment", - "kind": "module" - } - ], - "namespace": "Environment" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Environment" - }, - { - "title": "submodule", - "description": "Environment", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 85 - } - }, - "context": { - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 87 - }, - "end": { - "line": 8, - "column": 30, - "index": 117 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/accessibility/describe.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Environment", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Environment", - "kind": "module" - } - ], - "namespace": "Environment" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Environment" - }, - { - "title": "submodule", - "description": "Environment", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 85 - } - }, - "context": { - "loc": { - "start": { - "line": 7, - "column": 0, - "index": 86 - }, - "end": { - "line": 7, - "column": 30, - "index": 116 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/accessibility/gridOutput.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Environment", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Environment", - "kind": "module" - } - ], - "namespace": "Environment" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Environment" - }, - { - "title": "submodule", - "description": "Environment", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 85 - } - }, - "context": { - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 87 - }, - "end": { - "line": 8, - "column": 30, - "index": 117 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/accessibility/outputs.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Environment", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Environment", - "kind": "module" - } - ], - "namespace": "Environment" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Environment" - }, - { - "title": "submodule", - "description": "Environment", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 85 - } - }, - "context": { - "loc": { - "start": { - "line": 7, - "column": 0, - "index": 86 - }, - "end": { - "line": 7, - "column": 30, - "index": 116 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/accessibility/textOutput.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Environment", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Environment", - "kind": "module" - } - ], - "namespace": "Environment" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Environment" - }, - { - "title": "submodule", - "description": "Environment", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - }, - { - "title": "requires", - "description": null, - "lineNumber": 5, - "name": "constants" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 7, - "column": 3, - "index": 108 - } - }, - "context": { - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 110 - }, - "end": { - "line": 9, - "column": 24, - "index": 134 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Environment", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Environment", - "kind": "module" - } - ], - "namespace": "Environment" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a screen reader-accessible description for the canvas." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "text" - }, - { - "type": "text", - "value": ", is the description of the canvas." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "display" - }, - { - "type": "text", - "value": ", is optional. It determines how the\ndescription is displayed. If " - }, - { - "type": "inlineCode", - "value": "LABEL" - }, - { - "type": "text", - "value": " is passed, as in\n" - }, - { - "type": "inlineCode", - "value": "describe('A description.', LABEL)" - }, - { - "type": "text", - "value": ", the description will be visible in\na div element next to the canvas. If " - }, - { - "type": "inlineCode", - "value": "FALLBACK" - }, - { - "type": "text", - "value": " is passed, as in\n" - }, - { - "type": "inlineCode", - "value": "describe('A description.', FALLBACK)" - }, - { - "type": "text", - "value": ", the description will only be\nvisible to screen readers. This is the default mode." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Read\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "How to label your p5.js code" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to\nlearn more about making sketches accessible." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 16, - "name": "describe" - }, - { - "title": "param", - "description": "description of the canvas.", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "text" - }, - { - "title": "param", - "description": "either LABEL or FALLBACK.", - "lineNumber": 18, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "FALLBACK" - }, - { - "type": "NameExpression", - "name": "LABEL" - } - ] - } - }, - "name": "display" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 20 - } - ], - "loc": { - "start": { - "line": 18, - "column": 0, - "index": 569 - }, - "end": { - "line": 118, - "column": 3, - "index": 3167 - } - }, - "context": { - "loc": { - "start": { - "line": 120, - "column": 0, - "index": 3169 - }, - "end": { - "line": 160, - "column": 2, - "index": 4456 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/accessibility/describe.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "text", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "description of the canvas." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "display", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either LABEL or FALLBACK." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "FALLBACK" - }, - { - "type": "NameExpression", - "name": "LABEL" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "describe", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "describe", - "kind": "function" - } - ], - "namespace": "describe" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a screen reader-accessible description for elements in the canvas.\nElements are shapes or groups of shapes that create meaning together." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "name" - }, - { - "type": "text", - "value": ", is the name of the element." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "text" - }, - { - "type": "text", - "value": ", is the description of the element." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The third parameter, " - }, - { - "type": "inlineCode", - "value": "display" - }, - { - "type": "text", - "value": ", is optional. It determines how the\ndescription is displayed. If " - }, - { - "type": "inlineCode", - "value": "LABEL" - }, - { - "type": "text", - "value": " is passed, as in\n" - }, - { - "type": "inlineCode", - "value": "describe('A description.', LABEL)" - }, - { - "type": "text", - "value": ", the description will be visible in\na div element next to the canvas. Using " - }, - { - "type": "inlineCode", - "value": "LABEL" - }, - { - "type": "text", - "value": " creates unhelpful\nduplicates for screen readers. Only use " - }, - { - "type": "inlineCode", - "value": "LABEL" - }, - { - "type": "text", - "value": " during development. If\n" - }, - { - "type": "inlineCode", - "value": "FALLBACK" - }, - { - "type": "text", - "value": " is passed, as in " - }, - { - "type": "inlineCode", - "value": "describe('A description.', FALLBACK)" - }, - { - "type": "text", - "value": ", the\ndescription will only be visible to screen readers. This is the default\nmode." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Read\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "How to label your p5.js code" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to\nlearn more about making sketches accessible." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 21, - "name": "describeElement" - }, - { - "title": "param", - "description": "name of the element.", - "lineNumber": 22, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "name" - }, - { - "title": "param", - "description": "description of the element.", - "lineNumber": 23, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "text" - }, - { - "title": "param", - "description": "either LABEL or FALLBACK.", - "lineNumber": 24, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "FALLBACK" - }, - { - "type": "NameExpression", - "name": "LABEL" - } - ] - } - }, - "name": "display" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 26 - } - ], - "loc": { - "start": { - "line": 162, - "column": 0, - "index": 4458 - }, - "end": { - "line": 242, - "column": 3, - "index": 7070 - } - }, - "context": { - "loc": { - "start": { - "line": 244, - "column": 0, - "index": 7072 - }, - "end": { - "line": 296, - "column": 2, - "index": 9098 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/accessibility/describe.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "name", - "lineNumber": 22, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "name of the element." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "text", - "lineNumber": 23, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "description of the element." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "display", - "lineNumber": 24, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either LABEL or FALLBACK." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "FALLBACK" - }, - { - "type": "NameExpression", - "name": "LABEL" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "describeElement", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "describeElement", - "kind": "function" - } - ], - "namespace": "describeElement" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a screen reader-accessible description for shapes on the canvas.\n" - }, - { - "type": "inlineCode", - "value": "textOutput()" - }, - { - "type": "text", - "value": " adds a general description, list of shapes, and\ntable of shapes to the web page." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The general description includes the canvas size, canvas color, and number\nof shapes. For example,\n" - }, - { - "type": "inlineCode", - "value": "Your output is a, 100 by 100 pixels, gray canvas containing the following 2 shapes:" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A list of shapes follows the general description. The list describes the\ncolor, location, and area of each shape. For example,\n" - }, - { - "type": "inlineCode", - "value": "a red circle at middle covering 3% of the canvas" - }, - { - "type": "text", - "value": ". Each shape can be\nselected to get more details." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "textOutput()" - }, - { - "type": "text", - "value": " uses its table of shapes as a list. The table describes the\nshape, color, location, coordinates and area. For example,\n" - }, - { - "type": "inlineCode", - "value": "red circle location = middle area = 3%" - }, - { - "type": "text", - "value": ". This is different from\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "gridOutput()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", which uses its table as a grid." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "inlineCode", - "value": "display" - }, - { - "type": "text", - "value": " parameter is optional. It determines how the description is\ndisplayed. If " - }, - { - "type": "inlineCode", - "value": "LABEL" - }, - { - "type": "text", - "value": " is passed, as in " - }, - { - "type": "inlineCode", - "value": "textOutput(LABEL)" - }, - { - "type": "text", - "value": ", the description\nwill be visible in a div element next to the canvas. Using " - }, - { - "type": "inlineCode", - "value": "LABEL" - }, - { - "type": "text", - "value": " creates\nunhelpful duplicates for screen readers. Only use " - }, - { - "type": "inlineCode", - "value": "LABEL" - }, - { - "type": "text", - "value": " during\ndevelopment. If " - }, - { - "type": "inlineCode", - "value": "FALLBACK" - }, - { - "type": "text", - "value": " is passed, as in " - }, - { - "type": "inlineCode", - "value": "textOutput(FALLBACK)" - }, - { - "type": "text", - "value": ", the\ndescription will only be visible to screen readers. This is the default\nmode." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Read\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "How to label your p5.js code" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to\nlearn more about making sketches accessible." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 31, - "name": "textOutput" - }, - { - "title": "param", - "description": "either FALLBACK or LABEL.", - "lineNumber": 32, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "FALLBACK" - }, - { - "type": "NameExpression", - "name": "LABEL" - } - ] - } - }, - "name": "display" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 34 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 119 - }, - "end": { - "line": 124, - "column": 3, - "index": 3479 - } - }, - "context": { - "loc": { - "start": { - "line": 126, - "column": 0, - "index": 3481 - }, - "end": { - "line": 143, - "column": 2, - "index": 4034 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/accessibility/outputs.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "display", - "lineNumber": 32, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either FALLBACK or LABEL." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "FALLBACK" - }, - { - "type": "NameExpression", - "name": "LABEL" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "textOutput", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "textOutput", - "kind": "function" - } - ], - "namespace": "textOutput" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a screen reader-accessible description for shapes on the canvas.\n" - }, - { - "type": "inlineCode", - "value": "gridOutput()" - }, - { - "type": "text", - "value": " adds a general description, table of shapes, and list of\nshapes to the web page." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The general description includes the canvas size, canvas color, and number of\nshapes. For example,\n" - }, - { - "type": "inlineCode", - "value": "gray canvas, 100 by 100 pixels, contains 2 shapes: 1 circle 1 square" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "gridOutput()" - }, - { - "type": "text", - "value": " 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, " - }, - { - "type": "inlineCode", - "value": "red circle" - }, - { - "type": "text", - "value": ". These descriptions can be selected\nindividually to get more details. This is different from\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "textOutput()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", which uses its table as a list." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A list of shapes follows the table. The list describes the color, type,\nlocation, and area of each shape. For example,\n" - }, - { - "type": "inlineCode", - "value": "red circle, location = middle, area = 3 %" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "inlineCode", - "value": "display" - }, - { - "type": "text", - "value": " parameter is optional. It determines how the description is\ndisplayed. If " - }, - { - "type": "inlineCode", - "value": "LABEL" - }, - { - "type": "text", - "value": " is passed, as in " - }, - { - "type": "inlineCode", - "value": "gridOutput(LABEL)" - }, - { - "type": "text", - "value": ", the description\nwill be visible in a div element next to the canvas. Using " - }, - { - "type": "inlineCode", - "value": "LABEL" - }, - { - "type": "text", - "value": " creates\nunhelpful duplicates for screen readers. Only use " - }, - { - "type": "inlineCode", - "value": "LABEL" - }, - { - "type": "text", - "value": " during\ndevelopment. If " - }, - { - "type": "inlineCode", - "value": "FALLBACK" - }, - { - "type": "text", - "value": " is passed, as in " - }, - { - "type": "inlineCode", - "value": "gridOutput(FALLBACK)" - }, - { - "type": "text", - "value": ", the\ndescription will only be visible to screen readers. This is the default\nmode." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Read\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "How to label your p5.js code" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to\nlearn more about making sketches accessible." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 32, - "name": "gridOutput" - }, - { - "title": "param", - "description": "either FALLBACK or LABEL.", - "lineNumber": 33, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "FALLBACK" - }, - { - "type": "NameExpression", - "name": "LABEL" - } - ] - } - }, - "name": "display" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 35 - } - ], - "loc": { - "start": { - "line": 145, - "column": 0, - "index": 4036 - }, - "end": { - "line": 260, - "column": 3, - "index": 7477 - } - }, - "context": { - "loc": { - "start": { - "line": 262, - "column": 0, - "index": 7479 - }, - "end": { - "line": 279, - "column": 2, - "index": 8032 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/accessibility/outputs.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "display", - "lineNumber": 33, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either FALLBACK or LABEL." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "FALLBACK" - }, - { - "type": "NameExpression", - "name": "LABEL" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "gridOutput", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "gridOutput", - "kind": "function" - } - ], - "namespace": "gridOutput" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Color" - }, - { - "title": "submodule", - "description": "Color Conversion", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 84 - } - }, - "context": { - "loc": { - "start": { - "line": 16, - "column": 0, - "index": 335 - }, - "end": { - "line": 16, - "column": 30, - "index": 365 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/color_conversion.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Color", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Color", - "kind": "module" - } - ], - "namespace": "Color" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Color" - }, - { - "title": "submodule", - "description": "Creating & Reading", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - }, - { - "title": "requires", - "description": null, - "lineNumber": 5, - "name": "constants" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 7, - "column": 3, - "index": 109 - } - }, - "context": { - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 111 - }, - "end": { - "line": 9, - "column": 30, - "index": 141 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/creating_reading.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Color", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Color", - "kind": "module" - } - ], - "namespace": "Color" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Color" - }, - { - "title": "submodule", - "description": "Creating & Reading", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - }, - { - "title": "requires", - "description": null, - "lineNumber": 5, - "name": "constants" - }, - { - "title": "requires", - "description": null, - "lineNumber": 6, - "name": "color_conversion" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 8, - "column": 3, - "index": 139 - } - }, - "context": { - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 141 - }, - "end": { - "line": 10, - "column": 30, - "index": 171 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/p5.Color.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Color", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Color", - "kind": "module" - } - ], - "namespace": "Color" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Color" - }, - { - "title": "submodule", - "description": "Setting", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - }, - { - "title": "requires", - "description": null, - "lineNumber": 5, - "name": "constants" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 7, - "column": 3, - "index": 98 - } - }, - "context": { - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 100 - }, - "end": { - "line": 9, - "column": 30, - "index": 130 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Color", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Color", - "kind": "module" - } - ], - "namespace": "Color" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Convert an HSBA array to HSLA." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 18, - "column": 2, - "index": 391 - }, - "end": { - "line": 20, - "column": 5, - "index": 436 - } - }, - "context": { - "loc": { - "start": { - "line": 21, - "column": 2, - "index": 439 - }, - "end": { - "line": 42, - "column": 3, - "index": 889 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/color_conversion.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "hsba", - "lineNumber": 21 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_hsbaToHSLA", - "kind": "function", - "memberof": "p5.ColorConversion", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "_hsbaToHSLA", - "kind": "function", - "scope": "static" - } - ], - "namespace": "._hsbaToHSLA" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Convert an HSBA array to RGBA." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 44, - "column": 2, - "index": 894 - }, - "end": { - "line": 46, - "column": 5, - "index": 939 - } - }, - "context": { - "loc": { - "start": { - "line": 47, - "column": 2, - "index": 942 - }, - "end": { - "line": 97, - "column": 3, - "index": 2236 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/color_conversion.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "hsba", - "lineNumber": 47 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_hsbaToRGBA", - "kind": "function", - "memberof": "p5.ColorConversion", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "_hsbaToRGBA", - "kind": "function", - "scope": "static" - } - ], - "namespace": "._hsbaToRGBA" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Convert an HSLA array to HSBA." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 99, - "column": 2, - "index": 2241 - }, - "end": { - "line": 101, - "column": 5, - "index": 2286 - } - }, - "context": { - "loc": { - "start": { - "line": 102, - "column": 2, - "index": 2289 - }, - "end": { - "line": 120, - "column": 3, - "index": 2661 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/color_conversion.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "hsla", - "lineNumber": 102 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_hslaToHSBA", - "kind": "function", - "memberof": "p5.ColorConversion", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "_hslaToHSBA", - "kind": "function", - "scope": "static" - } - ], - "namespace": "._hslaToHSBA" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Convert an HSLA array to RGBA." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "We need to change basis from HSLA to something that can be more easily be\nprojected onto RGBA. We will choose hue and brightness as our first two\ncomponents, and pick a convenient third one ('zest') so that we don't need\nto calculate formal HSBA saturation." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 122, - "column": 2, - "index": 2666 - }, - "end": { - "line": 129, - "column": 5, - "index": 2994 - } - }, - "context": { - "loc": { - "start": { - "line": 130, - "column": 2, - "index": 2997 - }, - "end": { - "line": 184, - "column": 3, - "index": 4418 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/color_conversion.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "hsla", - "lineNumber": 130 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_hslaToRGBA", - "kind": "function", - "memberof": "p5.ColorConversion", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "_hslaToRGBA", - "kind": "function", - "scope": "static" - } - ], - "namespace": "._hslaToRGBA" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Convert an RGBA array to HSBA." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 186, - "column": 2, - "index": 4423 - }, - "end": { - "line": 188, - "column": 5, - "index": 4468 - } - }, - "context": { - "loc": { - "start": { - "line": 189, - "column": 2, - "index": 4471 - }, - "end": { - "line": 223, - "column": 3, - "index": 5314 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/color_conversion.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "rgba", - "lineNumber": 189 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_rgbaToHSBA", - "kind": "function", - "memberof": "p5.ColorConversion", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "_rgbaToHSBA", - "kind": "function", - "scope": "static" - } - ], - "namespace": "._rgbaToHSBA" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Convert an RGBA array to HSLA." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 225, - "column": 2, - "index": 5319 - }, - "end": { - "line": 227, - "column": 5, - "index": 5364 - } - }, - "context": { - "loc": { - "start": { - "line": 228, - "column": 2, - "index": 5367 - }, - "end": { - "line": 268, - "column": 3, - "index": 6366 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/color_conversion.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "rgba", - "lineNumber": 228 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_rgbaToHSLA", - "kind": "function", - "memberof": "p5.ColorConversion", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "_rgbaToHSLA", - "kind": "function", - "scope": "static" - } - ], - "namespace": "._rgbaToHSLA" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the color formatted as a string. Doing so can be useful for\ndebugging, or for using p5.js with other libraries." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "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.", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "format" - }, - { - "title": "return", - "description": "the formatted string.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 361, - "column": 2, - "index": 8980 - }, - "end": { - "line": 395, - "column": 5, - "index": 10227 - } - }, - "context": { - "loc": { - "start": { - "line": 396, - "column": 2, - "index": 10230 - }, - "end": { - "line": 561, - "column": 3, - "index": 15165 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/p5.Color.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "format", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the formatted string." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "toString", - "kind": "function", - "memberof": "p5.Color", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "toString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#toString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the red component of a color. The range depends on the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "colorMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". In the default RGB mode it's\nbetween 0 and 255." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "the new red value.", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "red" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 563, - "column": 2, - "index": 15169 - }, - "end": { - "line": 586, - "column": 5, - "index": 15773 - } - }, - "context": { - "loc": { - "start": { - "line": 587, - "column": 2, - "index": 15776 - }, - "end": { - "line": 590, - "column": 3, - "index": 15887 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/p5.Color.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "new_red", - "lineNumber": 587 - }, - { - "title": "param", - "name": "red", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the new red value." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setRed", - "kind": "function", - "memberof": "p5.Color", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setRed", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#setRed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the green component of a color. The range depends on the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "colorMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". In the default RGB mode it's\nbetween 0 and 255." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "the new green value.", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "green" - }, - { - "title": "example", - "description": "
\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*", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 592, - "column": 2, - "index": 15891 - }, - "end": { - "line": 615, - "column": 6, - "index": 16504 - } - }, - "context": { - "loc": { - "start": { - "line": 616, - "column": 2, - "index": 16507 - }, - "end": { - "line": 619, - "column": 3, - "index": 16624 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/p5.Color.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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*" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "new_green", - "lineNumber": 616 - }, - { - "title": "param", - "name": "green", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the new green value." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setGreen", - "kind": "function", - "memberof": "p5.Color", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setGreen", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#setGreen" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the blue component of a color. The range depends on the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "colorMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". In the default RGB mode it's\nbetween 0 and 255." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "the new blue value.", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "blue" - }, - { - "title": "example", - "description": "
\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*", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 621, - "column": 2, - "index": 16628 - }, - "end": { - "line": 644, - "column": 6, - "index": 17237 - } - }, - "context": { - "loc": { - "start": { - "line": 645, - "column": 2, - "index": 17240 - }, - "end": { - "line": 648, - "column": 3, - "index": 17354 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/p5.Color.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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*" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "new_blue", - "lineNumber": 645 - }, - { - "title": "param", - "name": "blue", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the new blue value." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setBlue", - "kind": "function", - "memberof": "p5.Color", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setBlue", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#setBlue" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the alpha (transparency) value of a color. The range depends on the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "colorMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". In the default RGB mode it's\nbetween 0 and 255." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "the new alpha value.", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "alpha" - }, - { - "title": "example", - "description": "
\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*", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 650, - "column": 2, - "index": 17358 - }, - "end": { - "line": 673, - "column": 6, - "index": 18030 - } - }, - "context": { - "loc": { - "start": { - "line": 674, - "column": 2, - "index": 18033 - }, - "end": { - "line": 677, - "column": 3, - "index": 18146 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/p5.Color.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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*" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "new_alpha", - "lineNumber": 674 - }, - { - "title": "param", - "name": "alpha", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the new alpha value." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setAlpha", - "kind": "function", - "memberof": "p5.Color", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setAlpha", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#setAlpha" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Hue is the same in HSB and HSL, but the maximum value may be different.\nThis function will return the HSB-normalized saturation when supplied with\nan HSB color object, but will default to the HSL-normalized saturation\notherwise." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 727, - "column": 2, - "index": 19238 - }, - "end": { - "line": 732, - "column": 5, - "index": 19496 - } - }, - "context": { - "loc": { - "start": { - "line": 733, - "column": 2, - "index": 19499 - }, - "end": { - "line": 745, - "column": 3, - "index": 19878 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/p5.Color.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_getHue", - "kind": "function", - "memberof": "p5.Color", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "_getHue", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#_getHue" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Saturation is scaled differently in HSB and HSL. This function will return\nthe HSB saturation when supplied with an HSB color object, but will default\nto the HSL saturation otherwise." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 758, - "column": 2, - "index": 20129 - }, - "end": { - "line": 762, - "column": 5, - "index": 20337 - } - }, - "context": { - "loc": { - "start": { - "line": 763, - "column": 2, - "index": 20340 - }, - "end": { - "line": 775, - "column": 3, - "index": 20726 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/p5.Color.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_getSaturation", - "kind": "function", - "memberof": "p5.Color", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "_getSaturation", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#_getSaturation" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Attaches this element to a parent element." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "For example, a " - }, - { - "type": "inlineCode", - "value": "<div></div>" - }, - { - "type": "text", - "value": " element may be used as a box to\nhold two pieces of text, a header and a paragraph. The\n" - }, - { - "type": "inlineCode", - "value": "<div></div>" - }, - { - "type": "text", - "value": " is the parent element of both the header and\nparagraph." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The parameter " - }, - { - "type": "inlineCode", - "value": "parent" - }, - { - "type": "text", - "value": " can have one of three types. " - }, - { - "type": "inlineCode", - "value": "parent" - }, - { - "type": "text", - "value": " can be a\nstring with the parent element's ID, as in\n" - }, - { - "type": "inlineCode", - "value": "myElement.parent('container')" - }, - { - "type": "text", - "value": ". It can also be another\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, as in\n" - }, - { - "type": "inlineCode", - "value": "myElement.parent(myDiv)" - }, - { - "type": "text", - "value": ". Finally, " - }, - { - "type": "inlineCode", - "value": "parent" - }, - { - "type": "text", - "value": " can be an " - }, - { - "type": "inlineCode", - "value": "HTMLElement" - }, - { - "type": "text", - "value": "\nobject, as in " - }, - { - "type": "inlineCode", - "value": "myElement.parent(anotherElement)" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "inlineCode", - "value": "myElement.parent()" - }, - { - "type": "text", - "value": " without an argument returns this element's\nparent." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID, p5.Element,\n or HTMLElement of desired parent element.", - "lineNumber": 18, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "p5.Element" - }, - { - "type": "NameExpression", - "name": "Object" - } - ] - }, - "name": "parent" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 20 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 61, - "column": 2, - "index": 1635 - }, - "end": { - "line": 166, - "column": 5, - "index": 5048 - } - }, - "context": { - "loc": { - "start": { - "line": 170, - "column": 2, - "index": 5089 - }, - "end": { - "line": 185, - "column": 3, - "index": 5425 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "p", - "lineNumber": 170 - }, - { - "title": "param", - "name": "parent", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID, " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\nor HTMLElement of desired parent element." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "p5.Element" - }, - { - "type": "NameExpression", - "name": "Object" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "parent", - "kind": "function", - "memberof": "p5.Element", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "parent", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#parent" - }, - { - "description": "", - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "loc": { - "start": { - "line": 167, - "column": 2, - "index": 5051 - }, - "end": { - "line": 169, - "column": 5, - "index": 5086 - } - }, - "context": { - "loc": { - "start": { - "line": 170, - "column": 2, - "index": 5089 - }, - "end": { - "line": 185, - "column": 3, - "index": 5425 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "p", - "lineNumber": 170 - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "parent", - "kind": "function", - "memberof": "p5.Element", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "parent", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#parent" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets this element's ID using a given string." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "inlineCode", - "value": "myElement.id()" - }, - { - "type": "text", - "value": " without an argument returns its ID as a string." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID of the element.", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "id" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 187, - "column": 2, - "index": 5429 - }, - "end": { - "line": 217, - "column": 5, - "index": 6126 - } - }, - "context": { - "loc": { - "start": { - "line": 221, - "column": 2, - "index": 6182 - }, - "end": { - "line": 230, - "column": 3, - "index": 6383 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "id", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID of the element." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "id", - "kind": "function", - "memberof": "p5.Element", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "id", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#id" - }, - { - "description": "", - "tags": [ - { - "title": "return", - "description": "ID of the element.", - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "loc": { - "start": { - "line": 218, - "column": 2, - "index": 6129 - }, - "end": { - "line": 220, - "column": 5, - "index": 6179 - } - }, - "context": { - "loc": { - "start": { - "line": 221, - "column": 2, - "index": 6182 - }, - "end": { - "line": 230, - "column": 3, - "index": 6383 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "id", - "lineNumber": 221 - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID of the element." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "id", - "kind": "function", - "memberof": "p5.Element", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "id", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#id" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Adds a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "class attribute" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nto the element." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "inlineCode", - "value": "myElement.class()" - }, - { - "type": "text", - "value": " without an argument returns a string with its current classes." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "class to add.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "class" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 232, - "column": 2, - "index": 6387 - }, - "end": { - "line": 266, - "column": 5, - "index": 7255 - } - }, - "context": { - "loc": { - "start": { - "line": 270, - "column": 2, - "index": 7319 - }, - "end": { - "line": 277, - "column": 3, - "index": 7454 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "c", - "lineNumber": 270 - }, - { - "title": "param", - "name": "class", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "class to add." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "class", - "kind": "function", - "memberof": "p5.Element", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "class", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#class" - }, - { - "description": "", - "tags": [ - { - "title": "return", - "description": "element's classes, if any.", - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "loc": { - "start": { - "line": 267, - "column": 2, - "index": 7258 - }, - "end": { - "line": 269, - "column": 5, - "index": 7316 - } - }, - "context": { - "loc": { - "start": { - "line": 270, - "column": 2, - "index": 7319 - }, - "end": { - "line": 277, - "column": 3, - "index": 7454 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "c", - "lineNumber": 270 - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "element's classes, if any." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "class", - "kind": "function", - "memberof": "p5.Element", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "class", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#class" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calls a function when the mouse is pressed over the element.\nCalling " - }, - { - "type": "inlineCode", - "value": "myElement.mousePressed(false)" - }, - { - "type": "text", - "value": " disables the function." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: Some mobile browsers may also trigger this event when the element\nreceives a quick tap." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "function to call when the mouse is\n pressed over the element.\n `false` disables the function.", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - }, - "name": "fxn" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 279, - "column": 2, - "index": 7458 - }, - "end": { - "line": 337, - "column": 5, - "index": 9093 - } - }, - "context": { - "loc": { - "start": { - "line": 338, - "column": 2, - "index": 9096 - }, - "end": { - "line": 351, - "column": 3, - "index": 9746 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fxn", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call when the mouse is\npressed over the element.\n" - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mousePressed", - "kind": "function", - "memberof": "p5.Element", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mousePressed", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#mousePressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calls a function when the mouse is pressed twice over the element.\nCalling " - }, - { - "type": "inlineCode", - "value": "myElement.doubleClicked(false)" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "function to call when the mouse is\n double clicked over the element.\n `false` disables the function.", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - }, - "name": "fxn" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 353, - "column": 2, - "index": 9750 - }, - "end": { - "line": 408, - "column": 5, - "index": 11332 - } - }, - "context": { - "loc": { - "start": { - "line": 409, - "column": 2, - "index": 11335 - }, - "end": { - "line": 412, - "column": 3, - "index": 11431 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fxn", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call when the mouse is\ndouble clicked over the element.\n" - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "doubleClicked", - "kind": "function", - "memberof": "p5.Element", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "doubleClicked", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#doubleClicked" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calls a function when the mouse wheel scrolls over th element." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The callback function, " - }, - { - "type": "inlineCode", - "value": "fxn" - }, - { - "type": "text", - "value": ", is passed an " - }, - { - "type": "inlineCode", - "value": "event" - }, - { - "type": "text", - "value": " object. " - }, - { - "type": "inlineCode", - "value": "event" - }, - { - "type": "text", - "value": " has\ntwo numeric properties, " - }, - { - "type": "inlineCode", - "value": "deltaY" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "deltaX" - }, - { - "type": "text", - "value": ". " - }, - { - "type": "inlineCode", - "value": "event.deltaY" - }, - { - "type": "text", - "value": " is\nnegative if the mouse wheel rotates away from the user. It's positive if\nthe mouse wheel rotates toward the user. " - }, - { - "type": "inlineCode", - "value": "event.deltaX" - }, - { - "type": "text", - "value": " is positive if\nthe mouse wheel moves to the right. It's negative if the mouse wheel moves\nto the left." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "inlineCode", - "value": "myElement.mouseWheel(false)" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "function to call when the mouse wheel is\n scrolled over the element.\n `false` disables the function.", - "lineNumber": 12, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - }, - "name": "fxn" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 15 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 16 - } - ], - "loc": { - "start": { - "line": 414, - "column": 2, - "index": 11435 - }, - "end": { - "line": 514, - "column": 5, - "index": 14380 - } - }, - "context": { - "loc": { - "start": { - "line": 515, - "column": 2, - "index": 14383 - }, - "end": { - "line": 518, - "column": 3, - "index": 14473 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fxn", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call when the mouse wheel is\nscrolled over the element.\n" - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseWheel", - "kind": "function", - "memberof": "p5.Element", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mouseWheel", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#mouseWheel" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calls a function when the mouse is released over the element. Calling\n" - }, - { - "type": "inlineCode", - "value": "myElement.mouseReleased(false)" - }, - { - "type": "text", - "value": " disables the function." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: Some mobile browsers may also trigger this event when the element\nreceives a quick tap." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "function to call when the mouse is\n pressed over the element.\n `false` disables the function.", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - }, - "name": "fxn" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 520, - "column": 2, - "index": 14477 - }, - "end": { - "line": 578, - "column": 5, - "index": 16132 - } - }, - "context": { - "loc": { - "start": { - "line": 579, - "column": 2, - "index": 16135 - }, - "end": { - "line": 582, - "column": 3, - "index": 16230 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fxn", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call when the mouse is\npressed over the element.\n" - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseReleased", - "kind": "function", - "memberof": "p5.Element", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mouseReleased", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#mouseReleased" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calls a function when the mouse is pressed and released over the element.\nCalling " - }, - { - "type": "inlineCode", - "value": "myElement.mouseReleased(false)" - }, - { - "type": "text", - "value": " disables the function." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: Some mobile browsers may also trigger this event when the element\nreceives a quick tap." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "function to call when the mouse is\n pressed and released over the element.\n `false` disables the function.", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - }, - "name": "fxn" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 584, - "column": 2, - "index": 16234 - }, - "end": { - "line": 642, - "column": 5, - "index": 17912 - } - }, - "context": { - "loc": { - "start": { - "line": 643, - "column": 2, - "index": 17915 - }, - "end": { - "line": 646, - "column": 3, - "index": 18007 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fxn", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call when the mouse is\npressed and released over the element.\n" - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseClicked", - "kind": "function", - "memberof": "p5.Element", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mouseClicked", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#mouseClicked" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calls a function when the mouse moves over the element. Calling\n" - }, - { - "type": "inlineCode", - "value": "myElement.mouseMoved(false)" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "function to call when the mouse\n moves over the element.\n `false` disables the function.", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - }, - "name": "fxn" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 648, - "column": 2, - "index": 18011 - }, - "end": { - "line": 703, - "column": 5, - "index": 19531 - } - }, - "context": { - "loc": { - "start": { - "line": 704, - "column": 2, - "index": 19534 - }, - "end": { - "line": 707, - "column": 3, - "index": 19628 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fxn", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call when the mouse\nmoves over the element.\n" - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseMoved", - "kind": "function", - "memberof": "p5.Element", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mouseMoved", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#mouseMoved" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calls a function when the mouse moves onto the element. Calling\n" - }, - { - "type": "inlineCode", - "value": "myElement.mouseOver(false)" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "function to call when the mouse\n moves onto the element.\n `false` disables the function.", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - }, - "name": "fxn" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 709, - "column": 2, - "index": 19632 - }, - "end": { - "line": 765, - "column": 5, - "index": 21191 - } - }, - "context": { - "loc": { - "start": { - "line": 766, - "column": 2, - "index": 21194 - }, - "end": { - "line": 769, - "column": 3, - "index": 21287 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fxn", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call when the mouse\nmoves onto the element.\n" - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseOver", - "kind": "function", - "memberof": "p5.Element", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mouseOver", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#mouseOver" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calls a function when the mouse moves off the element. Calling\n" - }, - { - "type": "inlineCode", - "value": "myElement.mouseOut(false)" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "function to call when the mouse\n moves off the element.\n `false` disables the function.", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - }, - "name": "fxn" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 771, - "column": 2, - "index": 21291 - }, - "end": { - "line": 827, - "column": 5, - "index": 22841 - } - }, - "context": { - "loc": { - "start": { - "line": 828, - "column": 2, - "index": 22844 - }, - "end": { - "line": 831, - "column": 3, - "index": 22935 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fxn", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call when the mouse\nmoves off the element.\n" - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseOut", - "kind": "function", - "memberof": "p5.Element", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mouseOut", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#mouseOut" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calls a function when the element is touched. Calling\n" - }, - { - "type": "inlineCode", - "value": "myElement.touchStarted(false)" - }, - { - "type": "text", - "value": " disables the function." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: Touch functions only work on mobile devices." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "function to call when the touch\n starts.\n `false` disables the function.", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - }, - "name": "fxn" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 833, - "column": 2, - "index": 22939 - }, - "end": { - "line": 891, - "column": 5, - "index": 24526 - } - }, - "context": { - "loc": { - "start": { - "line": 892, - "column": 2, - "index": 24529 - }, - "end": { - "line": 895, - "column": 3, - "index": 24626 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fxn", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call when the touch\nstarts.\n" - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "touchStarted", - "kind": "function", - "memberof": "p5.Element", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "touchStarted", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#touchStarted" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calls a function when the user touches the element and moves their\nfinger. Calling " - }, - { - "type": "inlineCode", - "value": "myElement.touchMoved(false)" - }, - { - "type": "text", - "value": " disables the\nfunction." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: Touch functions only work on mobile devices." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "function to call when the touch\n moves over the element.\n `false` disables the function.", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - }, - "name": "fxn" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 897, - "column": 2, - "index": 24630 - }, - "end": { - "line": 957, - "column": 5, - "index": 26311 - } - }, - "context": { - "loc": { - "start": { - "line": 958, - "column": 2, - "index": 26314 - }, - "end": { - "line": 961, - "column": 3, - "index": 26408 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fxn", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call when the touch\nmoves over the element.\n" - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "touchMoved", - "kind": "function", - "memberof": "p5.Element", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "touchMoved", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#touchMoved" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calls a function when the user stops touching the element. Calling\n" - }, - { - "type": "inlineCode", - "value": "myElement.touchMoved(false)" - }, - { - "type": "text", - "value": " disables the function." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: Touch functions only work on mobile devices." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "function to call when the touch\n ends.\n `false` disables the function.", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - }, - "name": "fxn" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 963, - "column": 2, - "index": 26412 - }, - "end": { - "line": 1023, - "column": 5, - "index": 28124 - } - }, - "context": { - "loc": { - "start": { - "line": 1024, - "column": 2, - "index": 28127 - }, - "end": { - "line": 1027, - "column": 3, - "index": 28220 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fxn", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call when the touch\nends.\n" - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "touchEnded", - "kind": "function", - "memberof": "p5.Element", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "touchEnded", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#touchEnded" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calls a function when a file is dragged over the element. Calling\n" - }, - { - "type": "inlineCode", - "value": "myElement.dragOver(false)" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "function to call when the file is\n dragged over the element.\n `false` disables the function.", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - }, - "name": "fxn" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 1029, - "column": 2, - "index": 28224 - }, - "end": { - "line": 1085, - "column": 5, - "index": 29721 - } - }, - "context": { - "loc": { - "start": { - "line": 1086, - "column": 2, - "index": 29724 - }, - "end": { - "line": 1089, - "column": 3, - "index": 29815 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fxn", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call when the file is\ndragged over the element.\n" - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dragOver", - "kind": "function", - "memberof": "p5.Element", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "dragOver", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#dragOver" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calls a function when a file is dragged off the element. Calling\nCalling " - }, - { - "type": "inlineCode", - "value": "myElement.dragLeave(false)" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "function to call when the file is\n dragged off the element.\n `false` disables the function.", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - }, - "name": "fxn" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 1091, - "column": 2, - "index": 29819 - }, - "end": { - "line": 1149, - "column": 5, - "index": 31385 - } - }, - "context": { - "loc": { - "start": { - "line": 1150, - "column": 2, - "index": 31388 - }, - "end": { - "line": 1153, - "column": 3, - "index": 31481 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fxn", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call when the file is\ndragged off the element.\n" - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dragLeave", - "kind": "function", - "memberof": "p5.Element", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "dragLeave", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#dragLeave" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper fxn for sharing pixel methods" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 1205, - "column": 2, - "index": 32522 - }, - "end": { - "line": 1207, - "column": 5, - "index": 32573 - } - }, - "context": { - "loc": { - "start": { - "line": 1208, - "column": 2, - "index": 32576 - }, - "end": { - "line": 1210, - "column": 3, - "index": 32631 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "prop", - "lineNumber": 1208 - }, - { - "title": "param", - "name": "value", - "lineNumber": 1208 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_setProperty", - "kind": "function", - "memberof": "p5.Element", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "_setProperty", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#_setProperty" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " will copy the behavior\nof the standard canvas." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 39 - } - ], - "loc": { - "start": { - "line": 73, - "column": 2, - "index": 1991 - }, - "end": { - "line": 116, - "column": 3, - "index": 3398 - } - }, - "context": { - "loc": { - "start": { - "line": 117, - "column": 2, - "index": 3401 - }, - "end": { - "line": 122, - "column": 3, - "index": 3518 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Graphics.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "reset", - "kind": "function", - "memberof": "p5.Graphics", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "reset", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#reset" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes a Graphics object from the page and frees any resources\nassociated with it." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - }, - { - "title": "alt", - "description": "no image\na multi-colored circle moving back and forth over a scrolling background.", - "lineNumber": 48 - } - ], - "loc": { - "start": { - "line": 124, - "column": 2, - "index": 3522 - }, - "end": { - "line": 175, - "column": 3, - "index": 4639 - } - }, - "context": { - "loc": { - "start": { - "line": 176, - "column": 2, - "index": 4642 - }, - "end": { - "line": 187, - "column": 3, - "index": 4980 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Graphics.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "remove", - "kind": "function", - "memberof": "p5.Graphics", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "remove", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#remove" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates and returns a new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Framebuffer" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ninside a p5.Graphics WebGL context." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This takes the same parameters as the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "global\ncreateFramebuffer function." - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "p5.Framebuffer" - } - } - ], - "loc": { - "start": { - "line": 190, - "column": 2, - "index": 4985 - }, - "end": { - "line": 197, - "column": 5, - "index": 5267 - } - }, - "context": { - "loc": { - "start": { - "line": 198, - "column": 2, - "index": 5270 - }, - "end": { - "line": 200, - "column": 3, - "index": 5348 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Graphics.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "options", - "lineNumber": 198 - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Framebuffer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createFramebuffer", - "kind": "function", - "memberof": "p5.Graphics", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createFramebuffer", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#createFramebuffer" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Resize our canvas element." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 119, - "column": 2, - "index": 3481 - }, - "end": { - "line": 121, - "column": 3, - "index": 3518 - } - }, - "context": { - "loc": { - "start": { - "line": 122, - "column": 2, - "index": 3521 - }, - "end": { - "line": 133, - "column": 3, - "index": 3905 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Renderer.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "w", - "lineNumber": 122 - }, - { - "title": "param", - "name": "h", - "lineNumber": 122 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "resize", - "kind": "function", - "memberof": "p5.Renderer", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "resize", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#resize" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function to check font type (system or otf)" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 467, - "column": 2, - "index": 13398 - }, - "end": { - "line": 469, - "column": 3, - "index": 13459 - } - }, - "context": { - "loc": { - "start": { - "line": 470, - "column": 2, - "index": 13462 - }, - "end": { - "line": 472, - "column": 3, - "index": 13563 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Renderer.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "f", - "lineNumber": 470, - "default": "this._textFont" - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_isOpenType", - "kind": "function", - "memberof": "p5.Renderer", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "_isOpenType", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#_isOpenType" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the number of key-value pairs currently stored in the Dictionary." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "the number of key-value pairs in the Dictionary", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 100, - "column": 2, - "index": 2323 - }, - "end": { - "line": 115, - "column": 5, - "index": 2777 - } - }, - "context": { - "loc": { - "start": { - "line": 116, - "column": 2, - "index": 2780 - }, - "end": { - "line": 118, - "column": 3, - "index": 2834 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the number of key-value pairs in the Dictionary" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "size", - "kind": "function", - "memberof": "p5.TypedDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "size", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#size" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns true if the given key exists in the Dictionary,\notherwise returns false." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "that you want to look up", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "key" - }, - { - "title": "return", - "description": "whether that key exists in Dictionary", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - }, - { - "title": "example", - "description": "
\n\nfunction setup() {\n let myDictionary = createStringDict('p5', 'js');\n print(myDictionary.hasKey('p5')); // logs true to console\n}\n
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 120, - "column": 2, - "index": 2838 - }, - "end": { - "line": 135, - "column": 5, - "index": 3291 - } - }, - "context": { - "loc": { - "start": { - "line": 137, - "column": 2, - "index": 3295 - }, - "end": { - "line": 139, - "column": 3, - "index": 3354 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nfunction setup() {\n let myDictionary = createStringDict('p5', 'js');\n print(myDictionary.hasKey('p5')); // logs true to console\n}\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "key", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "that you want to look up" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "whether that key exists in Dictionary" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "hasKey", - "kind": "function", - "memberof": "p5.TypedDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "hasKey", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#hasKey" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the value stored at the given key." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "key you want to access", - "lineNumber": 3, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "the" - }, - { - "title": "return", - "description": "the value stored at that key", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 141, - "column": 2, - "index": 3358 - }, - "end": { - "line": 156, - "column": 5, - "index": 3799 - } - }, - "context": { - "loc": { - "start": { - "line": 158, - "column": 2, - "index": 3803 - }, - "end": { - "line": 164, - "column": 3, - "index": 3969 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "key", - "lineNumber": 158 - }, - { - "title": "param", - "name": "the", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "key you want to access" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the value stored at that key" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "get", - "kind": "function", - "memberof": "p5.TypedDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "get", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#get" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Updates the value associated with the given key in case it already exists\nin the Dictionary. Otherwise a new key-value pair is added." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "key" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 166, - "column": 2, - "index": 3973 - }, - "end": { - "line": 182, - "column": 5, - "index": 4469 - } - }, - "context": { - "loc": { - "start": { - "line": 184, - "column": 2, - "index": 4473 - }, - "end": { - "line": 190, - "column": 3, - "index": 4647 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "key", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 5, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "set", - "kind": "function", - "memberof": "p5.TypedDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "set", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#set" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "private helper function to handle the user passing in objects\nduring construction or calls to create()" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 192, - "column": 2, - "index": 4651 - }, - "end": { - "line": 195, - "column": 5, - "index": 4773 - } - }, - "context": { - "loc": { - "start": { - "line": 197, - "column": 2, - "index": 4777 - }, - "end": { - "line": 201, - "column": 3, - "index": 4861 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "obj", - "lineNumber": 197 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_addObj", - "kind": "function", - "memberof": "p5.TypedDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "_addObj", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#_addObj" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a new key-value pair in the Dictionary." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "key" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 203, - "column": 2, - "index": 4865 - }, - "end": { - "line": 219, - "column": 5, - "index": 5321 - } - }, - "context": { - "loc": { - "start": { - "line": 223, - "column": 2, - "index": 5376 - }, - "end": { - "line": 234, - "column": 3, - "index": 5720 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "key", - "lineNumber": 3, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "create", - "kind": "function", - "memberof": "p5.TypedDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "create", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#create" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": "key/value pair", - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "Object" - }, - "name": "obj" - } - ], - "loc": { - "start": { - "line": 220, - "column": 2, - "index": 5324 - }, - "end": { - "line": 222, - "column": 5, - "index": 5373 - } - }, - "context": { - "loc": { - "start": { - "line": 223, - "column": 2, - "index": 5376 - }, - "end": { - "line": 234, - "column": 3, - "index": 5720 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "key", - "lineNumber": 223 - }, - { - "title": "param", - "name": "value", - "lineNumber": 223 - }, - { - "title": "param", - "name": "obj", - "lineNumber": 1, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "key/value pair" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "create", - "kind": "function", - "memberof": "p5.TypedDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "create", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#create" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes all previously stored key-value pairs from the Dictionary." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 236, - "column": 2, - "index": 5724 - }, - "end": { - "line": 250, - "column": 5, - "index": 6122 - } - }, - "context": { - "loc": { - "start": { - "line": 251, - "column": 2, - "index": 6125 - }, - "end": { - "line": 253, - "column": 3, - "index": 6158 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clear", - "kind": "function", - "memberof": "p5.TypedDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "clear", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#clear" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes the key-value pair stored at the given key from the Dictionary." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "for the pair to remove", - "lineNumber": 3, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "key" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 255, - "column": 2, - "index": 6162 - }, - "end": { - "line": 273, - "column": 5, - "index": 6753 - } - }, - "context": { - "loc": { - "start": { - "line": 274, - "column": 2, - "index": 6756 - }, - "end": { - "line": 280, - "column": 3, - "index": 6929 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "key", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "for the pair to remove" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "remove", - "kind": "function", - "memberof": "p5.TypedDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "remove", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#remove" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Logs the set of items currently stored in the Dictionary to the console." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 282, - "column": 2, - "index": 6933 - }, - "end": { - "line": 296, - "column": 5, - "index": 7349 - } - }, - "context": { - "loc": { - "start": { - "line": 297, - "column": 2, - "index": 7352 - }, - "end": { - "line": 301, - "column": 3, - "index": 7466 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "print", - "kind": "function", - "memberof": "p5.TypedDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "print", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#print" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Converts the Dictionary into a CSV file for local download." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 303, - "column": 2, - "index": 7470 - }, - "end": { - "line": 327, - "column": 5, - "index": 8032 - } - }, - "context": { - "loc": { - "start": { - "line": 328, - "column": 2, - "index": 8035 - }, - "end": { - "line": 337, - "column": 3, - "index": 8294 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "filename", - "lineNumber": 328 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "saveTable", - "kind": "function", - "memberof": "p5.TypedDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "saveTable", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#saveTable" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Converts the Dictionary into a JSON file for local download." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 339, - "column": 2, - "index": 8298 - }, - "end": { - "line": 363, - "column": 5, - "index": 8860 - } - }, - "context": { - "loc": { - "start": { - "line": 364, - "column": 2, - "index": 8863 - }, - "end": { - "line": 366, - "column": 3, - "index": 8945 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "filename", - "lineNumber": 364 - }, - { - "title": "param", - "name": "opt", - "lineNumber": 364 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "saveJSON", - "kind": "function", - "memberof": "p5.TypedDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "saveJSON", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#saveJSON" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "private helper function to ensure that the user passed in valid\nvalues for the Dictionary type" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 368, - "column": 2, - "index": 8949 - }, - "end": { - "line": 371, - "column": 5, - "index": 9063 - } - }, - "context": { - "loc": { - "start": { - "line": 372, - "column": 2, - "index": 9066 - }, - "end": { - "line": 374, - "column": 3, - "index": 9105 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 372 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_validate", - "kind": "function", - "memberof": "p5.TypedDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "_validate", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#_validate" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "private helper function to ensure that the user passed in valid\nvalues for the Dictionary type" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 407, - "column": 2, - "index": 9602 - }, - "end": { - "line": 410, - "column": 5, - "index": 9716 - } - }, - "context": { - "loc": { - "start": { - "line": 411, - "column": 2, - "index": 9719 - }, - "end": { - "line": 413, - "column": 3, - "index": 9779 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 411 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_validate", - "kind": "function", - "memberof": "p5.NumberDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "_validate", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#_validate" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Add the given number to the value currently stored at the given key.\nThe sum then replaces the value previously stored in the Dictionary." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "for the value you wish to add to", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "Key" - }, - { - "title": "param", - "description": "to add to the value", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "Number" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 415, - "column": 2, - "index": 9783 - }, - "end": { - "line": 431, - "column": 5, - "index": 10298 - } - }, - "context": { - "loc": { - "start": { - "line": 432, - "column": 2, - "index": 10301 - }, - "end": { - "line": 438, - "column": 3, - "index": 10489 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "key", - "lineNumber": 432 - }, - { - "title": "param", - "name": "amount", - "lineNumber": 432 - }, - { - "title": "param", - "name": "Key", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "for the value you wish to add to" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "Number", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "to add to the value" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "add", - "kind": "function", - "memberof": "p5.NumberDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "add", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#add" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Subtract the given number from the value currently stored at the given key.\nThe difference then replaces the value previously stored in the Dictionary." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "for the value you wish to subtract from", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "Key" - }, - { - "title": "param", - "description": "to subtract from the value", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "Number" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 440, - "column": 2, - "index": 10493 - }, - "end": { - "line": 456, - "column": 5, - "index": 11036 - } - }, - "context": { - "loc": { - "start": { - "line": 457, - "column": 2, - "index": 11039 - }, - "end": { - "line": 459, - "column": 3, - "index": 11089 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "key", - "lineNumber": 457 - }, - { - "title": "param", - "name": "amount", - "lineNumber": 457 - }, - { - "title": "param", - "name": "Key", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "for the value you wish to subtract from" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "Number", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "to subtract from the value" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "sub", - "kind": "function", - "memberof": "p5.NumberDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "sub", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#sub" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Multiply the given number with the value currently stored at the given key.\nThe product then replaces the value previously stored in the Dictionary." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "for value you wish to multiply", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "Key" - }, - { - "title": "param", - "description": "to multiply the value by", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "Amount" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 461, - "column": 2, - "index": 11093 - }, - "end": { - "line": 477, - "column": 5, - "index": 11623 - } - }, - "context": { - "loc": { - "start": { - "line": 478, - "column": 2, - "index": 11626 - }, - "end": { - "line": 484, - "column": 3, - "index": 11815 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "key", - "lineNumber": 478 - }, - { - "title": "param", - "name": "amount", - "lineNumber": 478 - }, - { - "title": "param", - "name": "Key", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "for value you wish to multiply" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "Amount", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "to multiply the value by" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mult", - "kind": "function", - "memberof": "p5.NumberDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mult", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#mult" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Divide the given number with the value currently stored at the given key.\nThe quotient then replaces the value previously stored in the Dictionary." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "for value you wish to divide", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "Key" - }, - { - "title": "param", - "description": "to divide the value by", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "Amount" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 486, - "column": 2, - "index": 11819 - }, - "end": { - "line": 502, - "column": 5, - "index": 12343 - } - }, - "context": { - "loc": { - "start": { - "line": 503, - "column": 2, - "index": 12346 - }, - "end": { - "line": 509, - "column": 3, - "index": 12534 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "key", - "lineNumber": 503 - }, - { - "title": "param", - "name": "amount", - "lineNumber": 503 - }, - { - "title": "param", - "name": "Key", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "for value you wish to divide" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "Amount", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "to divide the value by" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "div", - "kind": "function", - "memberof": "p5.NumberDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "div", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#div" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "private helper function for finding lowest or highest value\nthe argument 'flip' is used to flip the comparison arrow\nfrom 'less than' to 'greater than'" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 511, - "column": 2, - "index": 12538 - }, - "end": { - "line": 515, - "column": 5, - "index": 12714 - } - }, - "context": { - "loc": { - "start": { - "line": 516, - "column": 2, - "index": 12717 - }, - "end": { - "line": 532, - "column": 3, - "index": 13244 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "flip", - "lineNumber": 516 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_valueTest", - "kind": "function", - "memberof": "p5.NumberDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "_valueTest", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#_valueTest" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Return the lowest number currently stored in the Dictionary." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 534, - "column": 2, - "index": 13248 - }, - "end": { - "line": 547, - "column": 5, - "index": 13620 - } - }, - "context": { - "loc": { - "start": { - "line": 548, - "column": 2, - "index": 13623 - }, - "end": { - "line": 550, - "column": 3, - "index": 13670 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "minValue", - "kind": "function", - "memberof": "p5.NumberDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "minValue", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#minValue" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Return the highest number currently stored in the Dictionary." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 552, - "column": 2, - "index": 13674 - }, - "end": { - "line": 565, - "column": 5, - "index": 14047 - } - }, - "context": { - "loc": { - "start": { - "line": 566, - "column": 2, - "index": 14050 - }, - "end": { - "line": 568, - "column": 3, - "index": 14098 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "maxValue", - "kind": "function", - "memberof": "p5.NumberDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "maxValue", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#maxValue" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "private helper function for finding lowest or highest key\nthe argument 'flip' is used to flip the comparison arrow\nfrom 'less than' to 'greater than'" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 570, - "column": 2, - "index": 14102 - }, - "end": { - "line": 574, - "column": 5, - "index": 14276 - } - }, - "context": { - "loc": { - "start": { - "line": 575, - "column": 2, - "index": 14279 - }, - "end": { - "line": 589, - "column": 3, - "index": 14790 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "flip", - "lineNumber": 575 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_keyTest", - "kind": "function", - "memberof": "p5.NumberDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "_keyTest", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#_keyTest" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Return the lowest key currently used in the Dictionary." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 591, - "column": 2, - "index": 14794 - }, - "end": { - "line": 604, - "column": 5, - "index": 15150 - } - }, - "context": { - "loc": { - "start": { - "line": 605, - "column": 2, - "index": 15153 - }, - "end": { - "line": 607, - "column": 3, - "index": 15196 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "minKey", - "kind": "function", - "memberof": "p5.NumberDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "minKey", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#minKey" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Return the highest key currently used in the Dictionary." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 609, - "column": 2, - "index": 15200 - }, - "end": { - "line": 622, - "column": 5, - "index": 15557 - } - }, - "context": { - "loc": { - "start": { - "line": 623, - "column": 2, - "index": 15560 - }, - "end": { - "line": 625, - "column": 3, - "index": 15604 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "maxKey", - "kind": "function", - "memberof": "p5.NumberDict", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "maxKey", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#maxKey" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Play audio or video from a media element." - } - ] - } - ] - }, - "tags": [ - { - "title": "chainable", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 3726, - "column": 2, - "index": 109652 - }, - "end": { - "line": 3754, - "column": 5, - "index": 110303 - } - }, - "context": { - "loc": { - "start": { - "line": 3755, - "column": 2, - "index": 110306 - }, - "end": { - "line": 3783, - "column": 3, - "index": 111141 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "play", - "kind": "function", - "memberof": "p5.MediaElement", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "play", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#play" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Stops a media element and sets its current time to zero. Calling\n" - }, - { - "type": "inlineCode", - "value": "media.play()" - }, - { - "type": "text", - "value": " will restart playing audio/video from the beginning." - } - ] - } - ] - }, - "tags": [ - { - "title": "chainable", - "description": null, - "lineNumber": 4 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 3785, - "column": 2, - "index": 111145 - }, - "end": { - "line": 3831, - "column": 5, - "index": 112316 - } - }, - "context": { - "loc": { - "start": { - "line": 3832, - "column": 2, - "index": 112319 - }, - "end": { - "line": 3836, - "column": 3, - "index": 112400 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "stop", - "kind": "function", - "memberof": "p5.MediaElement", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "stop", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#stop" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Pauses a media element. Calling " - }, - { - "type": "inlineCode", - "value": "media.play()" - }, - { - "type": "text", - "value": " will resume playing\naudio/video from the moment it paused." - } - ] - } - ] - }, - "tags": [ - { - "title": "chainable", - "description": null, - "lineNumber": 4 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 3838, - "column": 2, - "index": 112404 - }, - "end": { - "line": 3886, - "column": 5, - "index": 113613 - } - }, - "context": { - "loc": { - "start": { - "line": 3887, - "column": 2, - "index": 113616 - }, - "end": { - "line": 3890, - "column": 3, - "index": 113668 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pause", - "kind": "function", - "memberof": "p5.MediaElement", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "pause", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#pause" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Play the audio/video repeatedly in a loop." - } - ] - } - ] - }, - "tags": [ - { - "title": "chainable", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 3892, - "column": 2, - "index": 113672 - }, - "end": { - "line": 3941, - "column": 5, - "index": 114887 - } - }, - "context": { - "loc": { - "start": { - "line": 3942, - "column": 2, - "index": 114890 - }, - "end": { - "line": 3946, - "column": 3, - "index": 114977 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "loop", - "kind": "function", - "memberof": "p5.MediaElement", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "loop", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#loop" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Stops the audio/video from playing in a loop. It will stop when it\nreaches the end." - } - ] - } - ] - }, - "tags": [ - { - "title": "chainable", - "description": null, - "lineNumber": 4 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 3947, - "column": 2, - "index": 114980 - }, - "end": { - "line": 3997, - "column": 5, - "index": 116220 - } - }, - "context": { - "loc": { - "start": { - "line": 3998, - "column": 2, - "index": 116223 - }, - "end": { - "line": 4001, - "column": 3, - "index": 116292 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "noLoop", - "kind": "function", - "memberof": "p5.MediaElement", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "noLoop", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#noLoop" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the audio/video to play once it's loaded." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The parameter, " - }, - { - "type": "inlineCode", - "value": "shouldAutoplay" - }, - { - "type": "text", - "value": ", is optional. Calling\n" - }, - { - "type": "inlineCode", - "value": "media.autoplay()" - }, - { - "type": "text", - "value": " without an argument causes the media to play\nautomatically. If " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": " is passed, as in " - }, - { - "type": "inlineCode", - "value": "media.autoplay(true)" - }, - { - "type": "text", - "value": ", the\nmedia will automatically play. If " - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " is passed, as in\n" - }, - { - "type": "inlineCode", - "value": "media.autoPlay(false)" - }, - { - "type": "text", - "value": ", it won't play automatically." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "whether the element should autoplay.", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - }, - "name": "shouldAutoplay" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 4022, - "column": 2, - "index": 116728 - }, - "end": { - "line": 4070, - "column": 5, - "index": 118155 - } - }, - "context": { - "loc": { - "start": { - "line": 4071, - "column": 2, - "index": 118158 - }, - "end": { - "line": 4092, - "column": 3, - "index": 118829 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "val", - "lineNumber": 4071 - }, - { - "title": "param", - "name": "shouldAutoplay", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "whether the element should autoplay." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "autoplay", - "kind": "function", - "memberof": "p5.MediaElement", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "autoplay", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#autoplay" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Manages the audio/video volume." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "inlineCode", - "value": "media.volume()" - }, - { - "type": "text", - "value": " without an argument returns the current volume\nas a number in the range 0 (off) to 1 (maximum)." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The parameter, " - }, - { - "type": "inlineCode", - "value": "val" - }, - { - "type": "text", - "value": ", is optional. It's a number that sets the volume\nfrom 0 (off) to 1 (maximum). For example, calling " - }, - { - "type": "inlineCode", - "value": "media.volume(0.5)" - }, - { - "type": "text", - "value": "\nsets the volume to half of its maximum." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "current volume.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 4094, - "column": 2, - "index": 118833 - }, - "end": { - "line": 4139, - "column": 5, - "index": 120183 - } - }, - "context": { - "loc": { - "start": { - "line": 4145, - "column": 2, - "index": 120298 - }, - "end": { - "line": 4151, - "column": 3, - "index": 120431 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "val", - "lineNumber": 4145 - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "current volume." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "volume", - "kind": "function", - "memberof": "p5.MediaElement", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "volume", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#volume" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Manages the audio/video playback speed. Calling " - }, - { - "type": "inlineCode", - "value": "media.speed()" - }, - { - "type": "text", - "value": " returns\nthe current speed as a number." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The parameter, " - }, - { - "type": "inlineCode", - "value": "val" - }, - { - "type": "text", - "value": ", 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: Not all browsers support backward playback. Even if they do,\nplayback might not be smooth." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "current playback speed.", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 4153, - "column": 2, - "index": 120435 - }, - "end": { - "line": 4200, - "column": 5, - "index": 121886 - } - }, - "context": { - "loc": { - "start": { - "line": 4205, - "column": 2, - "index": 121976 - }, - "end": { - "line": 4215, - "column": 3, - "index": 122244 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "val", - "lineNumber": 4205 - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "current playback speed." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "speed", - "kind": "function", - "memberof": "p5.MediaElement", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "speed", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#speed" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": "speed multiplier for playback.", - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "speed" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 2 - } - ], - "loc": { - "start": { - "line": 4201, - "column": 2, - "index": 121889 - }, - "end": { - "line": 4204, - "column": 5, - "index": 121973 - } - }, - "context": { - "loc": { - "start": { - "line": 4205, - "column": 2, - "index": 121976 - }, - "end": { - "line": 4215, - "column": 3, - "index": 122244 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "val", - "lineNumber": 4205 - }, - { - "title": "param", - "name": "speed", - "lineNumber": 1, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "speed multiplier for playback." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "speed", - "kind": "function", - "memberof": "p5.MediaElement", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "speed", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#speed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Manages the media element's playback time. Calling " - }, - { - "type": "inlineCode", - "value": "media.time()" - }, - { - "type": "text", - "value": "\nreturns the number of seconds the audio/video has played. Time resets to\n0 when the looping media restarts." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The parameter, " - }, - { - "type": "inlineCode", - "value": "time" - }, - { - "type": "text", - "value": ", is optional. It's a number that specifies the\ntime, in seconds, to jump to when playback begins." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "current time (in seconds).", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 4217, - "column": 2, - "index": 122248 - }, - "end": { - "line": 4285, - "column": 5, - "index": 124141 - } - }, - "context": { - "loc": { - "start": { - "line": 4290, - "column": 2, - "index": 124228 - }, - "end": { - "line": 4297, - "column": 3, - "index": 124388 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "val", - "lineNumber": 4290 - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "current time (in seconds)." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "time", - "kind": "function", - "memberof": "p5.MediaElement", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "time", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#time" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": "time to jump to (in seconds).", - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "time" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 2 - } - ], - "loc": { - "start": { - "line": 4286, - "column": 2, - "index": 124144 - }, - "end": { - "line": 4289, - "column": 5, - "index": 124225 - } - }, - "context": { - "loc": { - "start": { - "line": 4290, - "column": 2, - "index": 124228 - }, - "end": { - "line": 4297, - "column": 3, - "index": 124388 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "val", - "lineNumber": 4290 - }, - { - "title": "param", - "name": "time", - "lineNumber": 1, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "time to jump to (in seconds)." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "time", - "kind": "function", - "memberof": "p5.MediaElement", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "time", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#time" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the audio/video's duration in seconds." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "duration (in seconds).", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 4299, - "column": 2, - "index": 124392 - }, - "end": { - "line": 4335, - "column": 5, - "index": 125331 - } - }, - "context": { - "loc": { - "start": { - "line": 4336, - "column": 2, - "index": 125334 - }, - "end": { - "line": 4338, - "column": 3, - "index": 125380 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "duration (in seconds)." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "duration", - "kind": "function", - "memberof": "p5.MediaElement", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "duration", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#duration" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calls a function when the audio/video reaches the end of its playback\nThe function won't be called if the media is looping." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "inlineCode", - "value": "p5.MediaElement" - }, - { - "type": "text", - "value": " is passed as an argument to the callback function." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "function to call when playback ends.\n The `p5.MediaElement` is passed as\n the argument.", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Function" - }, - "name": "callback" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 4439, - "column": 2, - "index": 128260 - }, - "end": { - "line": 4495, - "column": 5, - "index": 129833 - } - }, - "context": { - "loc": { - "start": { - "line": 4496, - "column": 2, - "index": 129836 - }, - "end": { - "line": 4499, - "column": 3, - "index": 129906 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "callback", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call when playback ends.\nThe " - }, - { - "type": "inlineCode", - "value": "p5.MediaElement" - }, - { - "type": "text", - "value": " is passed as\nthe argument." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Function" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "onended", - "kind": "function", - "memberof": "p5.MediaElement", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "onended", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#onended" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This method is meant to be used with the p5.sound.js addon library." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "AudioNode from the Web Audio API,\nor an object from the p5.sound library", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "AudioNode" - }, - { - "type": "NameExpression", - "name": "Object" - } - ] - }, - "name": "audioNode" - } - ], - "loc": { - "start": { - "line": 4503, - "column": 2, - "index": 129962 - }, - "end": { - "line": 4513, - "column": 5, - "index": 130456 - } - }, - "context": { - "loc": { - "start": { - "line": 4514, - "column": 2, - "index": 130459 - }, - "end": { - "line": 4549, - "column": 3, - "index": 131570 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "obj", - "lineNumber": 4514 - }, - { - "title": "param", - "name": "audioNode", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "AudioNode from the Web Audio API,\nor an object from the p5.sound library" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "AudioNode" - }, - { - "type": "NameExpression", - "name": "Object" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "connect", - "kind": "function", - "memberof": "p5.MediaElement", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "connect", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#connect" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 4551, - "column": 2, - "index": 131574 - }, - "end": { - "line": 4555, - "column": 5, - "index": 131744 - } - }, - "context": { - "loc": { - "start": { - "line": 4556, - "column": 2, - "index": 131747 - }, - "end": { - "line": 4562, - "column": 3, - "index": 131894 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "disconnect", - "kind": "function", - "memberof": "p5.MediaElement", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "disconnect", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#disconnect" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Show the default\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "HTMLMediaElement" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ncontrols. These vary between web browser." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 4566, - "column": 2, - "index": 131932 - }, - "end": { - "line": 4590, - "column": 5, - "index": 132701 - } - }, - "context": { - "loc": { - "start": { - "line": 4591, - "column": 2, - "index": 132704 - }, - "end": { - "line": 4595, - "column": 3, - "index": 132858 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "showControls", - "kind": "function", - "memberof": "p5.MediaElement", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "showControls", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#showControls" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Hide the default\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "HTMLMediaElement" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ncontrols." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 4597, - "column": 2, - "index": 132862 - }, - "end": { - "line": 4642, - "column": 5, - "index": 134244 - } - }, - "context": { - "loc": { - "start": { - "line": 4643, - "column": 2, - "index": 134247 - }, - "end": { - "line": 4645, - "column": 3, - "index": 134298 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "hideControls", - "kind": "function", - "memberof": "p5.MediaElement", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "hideControls", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#hideControls" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Schedules a function to call when the audio/video reaches a specific time\nduring its playback." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "time" - }, - { - "type": "text", - "value": ", is the time, in seconds, when the function\nshould run. This value is passed to " - }, - { - "type": "inlineCode", - "value": "callback" - }, - { - "type": "text", - "value": " as its first argument." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "callback" - }, - { - "type": "text", - "value": ", is the function to call at the specified\ncue time." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The third parameter, " - }, - { - "type": "inlineCode", - "value": "value" - }, - { - "type": "text", - "value": ", is optional and can be any type of value.\n" - }, - { - "type": "inlineCode", - "value": "value" - }, - { - "type": "text", - "value": " is passed to " - }, - { - "type": "inlineCode", - "value": "callback" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "inlineCode", - "value": "media.addCue()" - }, - { - "type": "text", - "value": " returns an ID as a string. This is useful for\nremoving the cue later." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "cue time to run the callback function.", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "time" - }, - { - "title": "param", - "description": "function to call at the cue time.", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "Function" - }, - "name": "callback" - }, - { - "title": "param", - "description": "object to pass as the argument to\n `callback`.", - "lineNumber": 18, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - }, - "name": "value" - }, - { - "title": "return", - "description": "id ID of this cue,\n useful for `media.removeCue(id)`.", - "lineNumber": 20, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 4647, - "column": 2, - "index": 134302 - }, - "end": { - "line": 4692, - "column": 3, - "index": 135866 - } - }, - "context": { - "loc": { - "start": { - "line": 4693, - "column": 2, - "index": 135869 - }, - "end": { - "line": 4704, - "column": 3, - "index": 136134 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "time", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "cue time to run the callback function." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call at the cue time." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Function" - } - }, - { - "title": "param", - "name": "val", - "lineNumber": 4693 - }, - { - "title": "param", - "name": "value", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "object to pass as the argument to\n" - }, - { - "type": "inlineCode", - "value": "callback" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "id ID of this cue,\nuseful for " - }, - { - "type": "inlineCode", - "value": "media.removeCue(id)" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addCue", - "kind": "function", - "memberof": "p5.MediaElement", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "addCue", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#addCue" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Remove a callback based on its ID." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID of the cue, created by `media.addCue()`.", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "id" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 4706, - "column": 2, - "index": 136138 - }, - "end": { - "line": 4755, - "column": 3, - "index": 137522 - } - }, - "context": { - "loc": { - "start": { - "line": 4756, - "column": 2, - "index": 137525 - }, - "end": { - "line": 4767, - "column": 3, - "index": 137781 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "id", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID of the cue, created by " - }, - { - "type": "inlineCode", - "value": "media.addCue()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeCue", - "kind": "function", - "memberof": "p5.MediaElement", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "removeCue", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#removeCue" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes all functions scheduled with " - }, - { - "type": "inlineCode", - "value": "media.addCue()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 4769, - "column": 2, - "index": 137785 - }, - "end": { - "line": 4817, - "column": 3, - "index": 139055 - } - }, - "context": { - "loc": { - "start": { - "line": 4818, - "column": 2, - "index": 139058 - }, - "end": { - "line": 4821, - "column": 3, - "index": 139130 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clearCues", - "kind": "function", - "memberof": "p5.MediaElement", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "clearCues", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#clearCues" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Gets or sets the pixel density for high pixel density displays. By default,\nthe density will be set to 1." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "A scaling factor for the number of pixels per\nside", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "density" - }, - { - "title": "returns", - "description": "The current density if called without arguments, or the instance for chaining if setting density.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "loc": { - "start": { - "line": 104, - "column": 2, - "index": 2303 - }, - "end": { - "line": 115, - "column": 3, - "index": 2798 - } - }, - "context": { - "loc": { - "start": { - "line": 116, - "column": 2, - "index": 2801 - }, - "end": { - "line": 143, - "column": 3, - "index": 3540 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "density", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A scaling factor for the number of pixels per\nside" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The current density if called without arguments, or the instance for chaining if setting density." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pixelDensity", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "pixelDensity", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#pixelDensity" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for animating GIF-based images with time" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 145, - "column": 2, - "index": 3544 - }, - "end": { - "line": 147, - "column": 5, - "index": 3615 - } - }, - "context": { - "loc": { - "start": { - "line": 148, - "column": 2, - "index": 3618 - }, - "end": { - "line": 174, - "column": 3, - "index": 4666 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "pInst", - "lineNumber": 148 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_animateGif", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "_animateGif", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#_animateGif" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper fxn for sharing pixel methods" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 176, - "column": 2, - "index": 4670 - }, - "end": { - "line": 178, - "column": 5, - "index": 4721 - } - }, - "context": { - "loc": { - "start": { - "line": 179, - "column": 2, - "index": 4724 - }, - "end": { - "line": 182, - "column": 3, - "index": 4807 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "prop", - "lineNumber": 179 - }, - { - "title": "param", - "name": "value", - "lineNumber": 179 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_setProperty", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "_setProperty", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#_setProperty" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Loads the current value of each pixel in the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object into the " - }, - { - "type": "inlineCode", - "value": "img.pixels" - }, - { - "type": "text", - "value": " array.\nThis method must be called before reading or modifying pixel values." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 184, - "column": 2, - "index": 4811 - }, - "end": { - "line": 227, - "column": 5, - "index": 5972 - } - }, - "context": { - "loc": { - "start": { - "line": 228, - "column": 2, - "index": 5975 - }, - "end": { - "line": 231, - "column": 3, - "index": 6072 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "loadPixels", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "loadPixels", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#loadPixels" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Updates the canvas with the RGBA values in the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "img.pixels" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " array." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "img.updatePixels()" - }, - { - "type": "text", - "value": " only needs to be called after changing values in\nthe " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "img.pixels" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " array. Such changes can be\nmade directly after calling\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "img.loadPixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or by calling\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "img.set()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The optional parameters " - }, - { - "type": "inlineCode", - "value": "x" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "y" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "width" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "height" - }, - { - "type": "text", - "value": " define a\nsubsection of the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object to update.\nDoing so can improve performance in some cases." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object was loaded from a GIF,\nthen calling " - }, - { - "type": "inlineCode", - "value": "img.updatePixels()" - }, - { - "type": "text", - "value": " will update the pixels in current\nframe." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "x-coordinate of the upper-left corner\n of the subsection to update.", - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "x" - }, - { - "title": "param", - "description": "y-coordinate of the upper-left corner\n of the subsection to update.", - "lineNumber": 20, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "y" - }, - { - "title": "param", - "description": "width of the subsection to update.", - "lineNumber": 22, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "w" - }, - { - "title": "param", - "description": "height of the subsection to update.", - "lineNumber": 23, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "h" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 24 - } - ], - "loc": { - "start": { - "line": 233, - "column": 2, - "index": 6076 - }, - "end": { - "line": 295, - "column": 5, - "index": 8132 - } - }, - "context": { - "loc": { - "start": { - "line": 298, - "column": 2, - "index": 8147 - }, - "end": { - "line": 301, - "column": 3, - "index": 8270 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the upper-left corner\nof the subsection to update." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the upper-left corner\nof the subsection to update." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "w", - "lineNumber": 22, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "width of the subsection to update." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "h", - "lineNumber": 23, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "height of the subsection to update." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "updatePixels", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "updatePixels", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#updatePixels" - }, - { - "description": "", - "tags": [], - "loc": { - "start": { - "line": 296, - "column": 2, - "index": 8135 - }, - "end": { - "line": 297, - "column": 5, - "index": 8144 - } - }, - "context": { - "loc": { - "start": { - "line": 298, - "column": 2, - "index": 8147 - }, - "end": { - "line": 301, - "column": 3, - "index": 8270 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 298 - }, - { - "title": "param", - "name": "y", - "lineNumber": 298 - }, - { - "title": "param", - "name": "w", - "lineNumber": 298 - }, - { - "title": "param", - "name": "h", - "lineNumber": 298 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "updatePixels", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "updatePixels", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#updatePixels" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Gets a pixel or a region of pixels from a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "img.get()" - }, - { - "type": "text", - "value": " is easy to use but it's not as fast as\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "img.pixels" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". Use\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "img.pixels" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to read many pixel values." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "img.get()" - }, - { - "type": "text", - "value": " with no parameters returns the entire image." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "img.get()" - }, - { - "type": "text", - "value": " with two parameters interprets them as\ncoordinates. It returns an array with the " - }, - { - "type": "inlineCode", - "value": "[R, G, B, A]" - }, - { - "type": "text", - "value": " values of the\npixel at the given point." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "img.get()" - }, - { - "type": "text", - "value": " with four parameters interprets them as\ncoordinates and dimensions. It returns a subsection of the canvas as a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "img.get()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to work directly with\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " objects." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "x-coordinate of the pixel.", - "lineNumber": 23, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y-coordinate of the pixel.", - "lineNumber": 24, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "width of the subsection to be returned.", - "lineNumber": 25, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "w" - }, - { - "title": "param", - "description": "height of the subsection to be returned.", - "lineNumber": 26, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "h" - }, - { - "title": "return", - "description": "subsection as a p5.Image object.", - "lineNumber": 27, - "type": { - "type": "NameExpression", - "name": "p5.Image" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 28 - } - ], - "loc": { - "start": { - "line": 303, - "column": 2, - "index": 8274 - }, - "end": { - "line": 387, - "column": 5, - "index": 10870 - } - }, - "context": { - "loc": { - "start": { - "line": 396, - "column": 2, - "index": 11118 - }, - "end": { - "line": 399, - "column": 3, - "index": 11257 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 23, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the pixel." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 24, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the pixel." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "w", - "lineNumber": 25, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "width of the subsection to be returned." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "h", - "lineNumber": 26, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "height of the subsection to be returned." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "subsection as a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Image" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "get", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "get", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#get" - }, - { - "description": "", - "tags": [ - { - "title": "return", - "description": "whole p5.Image", - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "p5.Image" - } - } - ], - "loc": { - "start": { - "line": 388, - "column": 2, - "index": 10873 - }, - "end": { - "line": 390, - "column": 5, - "index": 10951 - } - }, - "context": { - "loc": { - "start": { - "line": 396, - "column": 2, - "index": 11118 - }, - "end": { - "line": 399, - "column": 3, - "index": 11257 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 396 - }, - { - "title": "param", - "name": "y", - "lineNumber": 396 - }, - { - "title": "param", - "name": "w", - "lineNumber": 396 - }, - { - "title": "param", - "name": "h", - "lineNumber": 396 - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "whole " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Image" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "get", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "get", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#get" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": null, - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "return", - "description": "color of the pixel at (x, y) in array format `[R, G, B, A]`.", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "loc": { - "start": { - "line": 391, - "column": 2, - "index": 10954 - }, - "end": { - "line": 395, - "column": 5, - "index": 11115 - } - }, - "context": { - "loc": { - "start": { - "line": 396, - "column": 2, - "index": 11118 - }, - "end": { - "line": 399, - "column": 3, - "index": 11257 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "w", - "lineNumber": 396 - }, - { - "title": "param", - "name": "h", - "lineNumber": 396 - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "color of the pixel at (x, y) in array format " - }, - { - "type": "inlineCode", - "value": "[R, G, B, A]" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "get", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "get", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#get" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the color of one or more pixels within a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "img.set()" - }, - { - "type": "text", - "value": " is easy to use but it's not as fast as\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "img.pixels" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". Use\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "img.pixels" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to set many pixel values." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "img.set()" - }, - { - "type": "text", - "value": " interprets the first two parameters as x- and y-coordinates. It\ninterprets the last parameter as a grayscale value, a " - }, - { - "type": "inlineCode", - "value": "[R, G, B, A]" - }, - { - "type": "text", - "value": " pixel\narray, a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, or another\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "img.updatePixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " must be called\nafter using " - }, - { - "type": "inlineCode", - "value": "img.set()" - }, - { - "type": "text", - "value": " for changes to appear." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "x-coordinate of the pixel.", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y-coordinate of the pixel.", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "grayscale value | pixel array |\n p5.Color object |\n p5.Image to copy.", - "lineNumber": 18, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "Object" - } - ] - }, - "name": "a" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 21 - } - ], - "loc": { - "start": { - "line": 405, - "column": 2, - "index": 11353 - }, - "end": { - "line": 489, - "column": 5, - "index": 13914 - } - }, - "context": { - "loc": { - "start": { - "line": 490, - "column": 2, - "index": 13917 - }, - "end": { - "line": 493, - "column": 3, - "index": 14030 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the pixel." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the pixel." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "imgOrCol", - "lineNumber": 490 - }, - { - "title": "param", - "name": "a", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "grayscale value | pixel array |\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object |\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to copy." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "Object" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "set", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "set", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#set" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Resizes the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object to a given " - }, - { - "type": "inlineCode", - "value": "width" - }, - { - "type": "text", - "value": "\nand " - }, - { - "type": "inlineCode", - "value": "height" - }, - { - "type": "text", - "value": ". The image's original aspect ratio can be kept by passing 0\nfor either " - }, - { - "type": "inlineCode", - "value": "width" - }, - { - "type": "text", - "value": " or " - }, - { - "type": "inlineCode", - "value": "height" - }, - { - "type": "text", - "value": ". For example, calling " - }, - { - "type": "inlineCode", - "value": "img.resize(50, 0)" - }, - { - "type": "text", - "value": "\non an image that was 500 × 300 pixels will resize it to\n50 × 30 pixels." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "resized image width.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "width" - }, - { - "title": "param", - "description": "resized image height.", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "height" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 495, - "column": 2, - "index": 14034 - }, - "end": { - "line": 558, - "column": 5, - "index": 15644 - } - }, - "context": { - "loc": { - "start": { - "line": 559, - "column": 2, - "index": 15647 - }, - "end": { - "line": 636, - "column": 3, - "index": 18259 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "width", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "resized image width." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "height", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "resized image height." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "resize", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "resize", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#resize" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Copies pixels from a source " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nto this one. Calling " - }, - { - "type": "inlineCode", - "value": "img.copy()" - }, - { - "type": "text", - "value": " will scale pixels from the source\nregion if it isn't the same size as the destination region." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "source image.", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Image" - }, - { - "type": "NameExpression", - "name": "p5.Element" - } - ] - }, - "name": "srcImage" - }, - { - "title": "param", - "description": "x-coordinate of the source's upper-left corner.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sx" - }, - { - "title": "param", - "description": "y-coordinate of the source's upper-left corner.", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sy" - }, - { - "title": "param", - "description": "source image width.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sw" - }, - { - "title": "param", - "description": "source image height.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sh" - }, - { - "title": "param", - "description": "x-coordinate of the destination's upper-left corner.", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dx" - }, - { - "title": "param", - "description": "y-coordinate of the destination's upper-left corner.", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dy" - }, - { - "title": "param", - "description": "destination image width.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dw" - }, - { - "title": "param", - "description": "destination image height.", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dh" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 16 - } - ], - "loc": { - "start": { - "line": 638, - "column": 2, - "index": 18263 - }, - "end": { - "line": 696, - "column": 5, - "index": 20106 - } - }, - "context": { - "loc": { - "start": { - "line": 707, - "column": 2, - "index": 20329 - }, - "end": { - "line": 709, - "column": 3, - "index": 20389 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "args", - "lineNumber": 707, - "type": { - "type": "RestType" - } - }, - { - "title": "param", - "name": "srcImage", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "source image." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Image" - }, - { - "type": "NameExpression", - "name": "p5.Element" - } - ] - } - }, - { - "title": "param", - "name": "sx", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the source's upper-left corner." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sy", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the source's upper-left corner." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sw", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "source image width." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sh", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "source image height." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dx", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the destination's upper-left corner." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dy", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the destination's upper-left corner." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dw", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "destination image width." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dh", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "destination image height." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "copy", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "copy", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#copy" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": null, - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sx" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sy" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sw" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sh" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dx" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dy" - }, - { - "title": "param", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dw" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dh" - } - ], - "loc": { - "start": { - "line": 697, - "column": 2, - "index": 20109 - }, - "end": { - "line": 706, - "column": 5, - "index": 20326 - } - }, - "context": { - "loc": { - "start": { - "line": 707, - "column": 2, - "index": 20329 - }, - "end": { - "line": 709, - "column": 3, - "index": 20389 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "args", - "lineNumber": 707, - "type": { - "type": "RestType" - } - }, - { - "title": "param", - "name": "sx", - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sy", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sw", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sh", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dx", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dy", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dw", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dh", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "copy", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "copy", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#copy" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "source image.", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "p5.Image" - }, - "name": "srcImage" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 711, - "column": 2, - "index": 20393 - }, - "end": { - "line": 738, - "column": 5, - "index": 21127 - } - }, - "context": { - "loc": { - "start": { - "line": 740, - "column": 2, - "index": 21176 - }, - "end": { - "line": 789, - "column": 3, - "index": 22408 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "p5Image", - "lineNumber": 740 - }, - { - "title": "param", - "name": "srcImage", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "source image." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Image" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mask", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mask", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#mask" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Applies an image filter to the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object.\nThe preset options are:" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "INVERT" - }, - { - "type": "text", - "value": "\nInverts the colors in the image. No parameter is used." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "GRAY" - }, - { - "type": "text", - "value": "\nConverts the image to grayscale. No parameter is used." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "THRESHOLD" - }, - { - "type": "text", - "value": "\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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "OPAQUE" - }, - { - "type": "text", - "value": "\nSets the alpha channel to be entirely opaque. No parameter is used." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "POSTERIZE" - }, - { - "type": "text", - "value": "\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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "BLUR" - }, - { - "type": "text", - "value": "\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 " - }, - { - "type": "inlineCode", - "value": "P2D" - }, - { - "type": "text", - "value": " mode. A box blur is used in " - }, - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " mode." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "ERODE" - }, - { - "type": "text", - "value": "\nReduces the light areas. No parameter is used." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "DILATE" - }, - { - "type": "text", - "value": "\nIncreases the light areas. No parameter is used." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "either THRESHOLD, GRAY, OPAQUE, INVERT,\n POSTERIZE, ERODE, DILATE or BLUR.", - "lineNumber": 35, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "THRESHOLD" - }, - { - "type": "NameExpression", - "name": "GRAY" - }, - { - "type": "NameExpression", - "name": "OPAQUE" - }, - { - "type": "NameExpression", - "name": "INVERT" - }, - { - "type": "NameExpression", - "name": "POSTERIZE" - }, - { - "type": "NameExpression", - "name": "ERODE" - }, - { - "type": "NameExpression", - "name": "DILATE" - }, - { - "type": "NameExpression", - "name": "BLUR" - } - ] - }, - "name": "filterType" - }, - { - "title": "param", - "description": "parameter unique to each filter.", - "lineNumber": 37, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "filterParam" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 38 - } - ], - "loc": { - "start": { - "line": 791, - "column": 2, - "index": 22412 - }, - "end": { - "line": 965, - "column": 5, - "index": 26407 - } - }, - "context": { - "loc": { - "start": { - "line": 966, - "column": 2, - "index": 26410 - }, - "end": { - "line": 969, - "column": 3, - "index": 26527 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "operation", - "lineNumber": 966 - }, - { - "title": "param", - "name": "value", - "lineNumber": 966 - }, - { - "title": "param", - "name": "filterType", - "lineNumber": 35, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either THRESHOLD, GRAY, OPAQUE, INVERT,\nPOSTERIZE, ERODE, DILATE or BLUR." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "THRESHOLD" - }, - { - "type": "NameExpression", - "name": "GRAY" - }, - { - "type": "NameExpression", - "name": "OPAQUE" - }, - { - "type": "NameExpression", - "name": "INVERT" - }, - { - "type": "NameExpression", - "name": "POSTERIZE" - }, - { - "type": "NameExpression", - "name": "ERODE" - }, - { - "type": "NameExpression", - "name": "DILATE" - }, - { - "type": "NameExpression", - "name": "BLUR" - } - ] - } - }, - { - "title": "param", - "name": "filterParam", - "lineNumber": 37, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "parameter unique to each filter." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "filter", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "filter", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#filter" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Copies a region of pixels from another\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object into this one. The " - }, - { - "type": "inlineCode", - "value": "blendMode" - }, - { - "type": "text", - "value": "\nparameter blends the images' colors to create different effects." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "source image", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Image" - }, - "name": "srcImage" - }, - { - "title": "param", - "description": "x-coordinate of the source's upper-left corner.", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sx" - }, - { - "title": "param", - "description": "y-coordinate of the source's upper-left corner.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sy" - }, - { - "title": "param", - "description": "source image width.", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sw" - }, - { - "title": "param", - "description": "source image height.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sh" - }, - { - "title": "param", - "description": "x-coordinate of the destination's upper-left corner.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dx" - }, - { - "title": "param", - "description": "y-coordinate of the destination's upper-left corner.", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dy" - }, - { - "title": "param", - "description": "destination image width.", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dw" - }, - { - "title": "param", - "description": "destination image height.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dh" - }, - { - "title": "param", - "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\nAvailable 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\nhttp://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/", - "lineNumber": 14, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "BLEND" - }, - { - "type": "NameExpression", - "name": "DARKEST" - }, - { - "type": "NameExpression", - "name": "LIGHTEST" - }, - { - "type": "NameExpression", - "name": "DIFFERENCE" - }, - { - "type": "NameExpression", - "name": "MULTIPLY" - }, - { - "type": "NameExpression", - "name": "EXCLUSION" - }, - { - "type": "NameExpression", - "name": "SCREEN" - }, - { - "type": "NameExpression", - "name": "REPLACE" - }, - { - "type": "NameExpression", - "name": "OVERLAY" - }, - { - "type": "NameExpression", - "name": "HARD_LIGHT" - }, - { - "type": "NameExpression", - "name": "SOFT_LIGHT" - }, - { - "type": "NameExpression", - "name": "DODGE" - }, - { - "type": "NameExpression", - "name": "BURN" - }, - { - "type": "NameExpression", - "name": "ADD" - }, - { - "type": "NameExpression", - "name": "NORMAL" - } - ] - }, - "name": "blendMode" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 971, - "column": 2, - "index": 26531 - }, - "end": { - "line": 1056, - "column": 5, - "index": 29605 - } - }, - "context": { - "loc": { - "start": { - "line": 1068, - "column": 2, - "index": 29975 - }, - "end": { - "line": 1072, - "column": 3, - "index": 30122 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "args", - "lineNumber": 1068, - "type": { - "type": "RestType" - } - }, - { - "title": "param", - "name": "srcImage", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "source image" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Image" - } - }, - { - "title": "param", - "name": "sx", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the source's upper-left corner." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sy", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the source's upper-left corner." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sw", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "source image width." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sh", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "source image height." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dx", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the destination's upper-left corner." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dy", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the destination's upper-left corner." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dw", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "destination image width." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dh", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "destination image height." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "blendMode", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the blend mode. either\nBLEND, DARKEST, LIGHTEST, DIFFERENCE,\nMULTIPLY, EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT,\nSOFT_LIGHT, DODGE, BURN, ADD or NORMAL." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Available blend modes are: normal | multiply | screen | overlay |\ndarken | lighten | color-dodge | color-burn | hard-light |\nsoft-light | difference | exclusion | hue | saturation |\ncolor | luminosity" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "link", - "title": null, - "url": "http://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/", - "children": [ - { - "type": "text", - "value": "http://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/" - } - ] - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "BLEND" - }, - { - "type": "NameExpression", - "name": "DARKEST" - }, - { - "type": "NameExpression", - "name": "LIGHTEST" - }, - { - "type": "NameExpression", - "name": "DIFFERENCE" - }, - { - "type": "NameExpression", - "name": "MULTIPLY" - }, - { - "type": "NameExpression", - "name": "EXCLUSION" - }, - { - "type": "NameExpression", - "name": "SCREEN" - }, - { - "type": "NameExpression", - "name": "REPLACE" - }, - { - "type": "NameExpression", - "name": "OVERLAY" - }, - { - "type": "NameExpression", - "name": "HARD_LIGHT" - }, - { - "type": "NameExpression", - "name": "SOFT_LIGHT" - }, - { - "type": "NameExpression", - "name": "DODGE" - }, - { - "type": "NameExpression", - "name": "BURN" - }, - { - "type": "NameExpression", - "name": "ADD" - }, - { - "type": "NameExpression", - "name": "NORMAL" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "blend", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "blend", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#blend" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": null, - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sx" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sy" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sw" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sh" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dx" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dy" - }, - { - "title": "param", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dw" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dh" - }, - { - "title": "param", - "description": null, - "lineNumber": 9, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "BLEND" - }, - { - "type": "NameExpression", - "name": "DARKEST" - }, - { - "type": "NameExpression", - "name": "LIGHTEST" - }, - { - "type": "NameExpression", - "name": "DIFFERENCE" - }, - { - "type": "NameExpression", - "name": "MULTIPLY" - }, - { - "type": "NameExpression", - "name": "EXCLUSION" - }, - { - "type": "NameExpression", - "name": "SCREEN" - }, - { - "type": "NameExpression", - "name": "REPLACE" - }, - { - "type": "NameExpression", - "name": "OVERLAY" - }, - { - "type": "NameExpression", - "name": "HARD_LIGHT" - }, - { - "type": "NameExpression", - "name": "SOFT_LIGHT" - }, - { - "type": "NameExpression", - "name": "DODGE" - }, - { - "type": "NameExpression", - "name": "BURN" - }, - { - "type": "NameExpression", - "name": "ADD" - }, - { - "type": "NameExpression", - "name": "NORMAL" - } - ] - }, - "name": "blendMode" - } - ], - "loc": { - "start": { - "line": 1057, - "column": 2, - "index": 29608 - }, - "end": { - "line": 1067, - "column": 5, - "index": 29972 - } - }, - "context": { - "loc": { - "start": { - "line": 1068, - "column": 2, - "index": 29975 - }, - "end": { - "line": 1072, - "column": 3, - "index": 30122 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "args", - "lineNumber": 1068, - "type": { - "type": "RestType" - } - }, - { - "title": "param", - "name": "sx", - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sy", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sw", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sh", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dx", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dy", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dw", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dh", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "blendMode", - "lineNumber": 9, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "BLEND" - }, - { - "type": "NameExpression", - "name": "DARKEST" - }, - { - "type": "NameExpression", - "name": "LIGHTEST" - }, - { - "type": "NameExpression", - "name": "DIFFERENCE" - }, - { - "type": "NameExpression", - "name": "MULTIPLY" - }, - { - "type": "NameExpression", - "name": "EXCLUSION" - }, - { - "type": "NameExpression", - "name": "SCREEN" - }, - { - "type": "NameExpression", - "name": "REPLACE" - }, - { - "type": "NameExpression", - "name": "OVERLAY" - }, - { - "type": "NameExpression", - "name": "HARD_LIGHT" - }, - { - "type": "NameExpression", - "name": "SOFT_LIGHT" - }, - { - "type": "NameExpression", - "name": "DODGE" - }, - { - "type": "NameExpression", - "name": "BURN" - }, - { - "type": "NameExpression", - "name": "ADD" - }, - { - "type": "NameExpression", - "name": "NORMAL" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "blend", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "blend", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#blend" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Saves the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object to a file.\nThe browser will either save the file immediately or prompt the user\nwith a dialogue window." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "By default, calling " - }, - { - "type": "inlineCode", - "value": "img.save()" - }, - { - "type": "text", - "value": " will save the image as " - }, - { - "type": "inlineCode", - "value": "untitled.png" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "inlineCode", - "value": "img.save()" - }, - { - "type": "text", - "value": " with one argument, as in " - }, - { - "type": "inlineCode", - "value": "img.save('photo.png')" - }, - { - "type": "text", - "value": ",\nwill set the image's filename and type together." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "inlineCode", - "value": "img.save()" - }, - { - "type": "text", - "value": " with two arguments, as in\n" - }, - { - "type": "inlineCode", - "value": "image.save('photo', 'png')" - }, - { - "type": "text", - "value": ", will set the image's filename and type\nseparately." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The image will only be downloaded as an animated GIF if the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object was loaded from a GIF file.\nSee " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "saveGif()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to create new GIFs." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "filename. Defaults to 'untitled'.", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "filename" - }, - { - "title": "param", - "description": "file extension, either 'png' or 'jpg'.\n Defaults to 'png'.", - "lineNumber": 18, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "extension" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 20 - } - ], - "loc": { - "start": { - "line": 1098, - "column": 2, - "index": 30861 - }, - "end": { - "line": 1144, - "column": 5, - "index": 32316 - } - }, - "context": { - "loc": { - "start": { - "line": 1145, - "column": 2, - "index": 32319 - }, - "end": { - "line": 1151, - "column": 3, - "index": 32521 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "filename", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "filename. Defaults to 'untitled'." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "extension", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "file extension, either 'png' or 'jpg'.\nDefaults to 'png'." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "save", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "save", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#save" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Restarts an animated GIF at its first frame." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 1154, - "column": 2, - "index": 32542 - }, - "end": { - "line": 1178, - "column": 5, - "index": 33054 - } - }, - "context": { - "loc": { - "start": { - "line": 1179, - "column": 2, - "index": 33057 - }, - "end": { - "line": 1190, - "column": 3, - "index": 33395 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "reset", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "reset", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#reset" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Gets the index of the current frame in an animated GIF." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "index of the GIF's current frame.", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 1192, - "column": 2, - "index": 33399 - }, - "end": { - "line": 1214, - "column": 5, - "index": 34013 - } - }, - "context": { - "loc": { - "start": { - "line": 1215, - "column": 2, - "index": 34016 - }, - "end": { - "line": 1220, - "column": 3, - "index": 34166 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "index of the GIF's current frame." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getCurrentFrame", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "getCurrentFrame", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#getCurrentFrame" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the current frame in an animated GIF." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "index of the frame to display.", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "index" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 1222, - "column": 2, - "index": 34170 - }, - "end": { - "line": 1252, - "column": 5, - "index": 34893 - } - }, - "context": { - "loc": { - "start": { - "line": 1253, - "column": 2, - "index": 34896 - }, - "end": { - "line": 1267, - "column": 3, - "index": 35380 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "index", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "index of the frame to display." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setFrame", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setFrame", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#setFrame" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the number of frames in an animated GIF." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "number of frames in the GIF.", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 1269, - "column": 2, - "index": 35384 - }, - "end": { - "line": 1293, - "column": 5, - "index": 35984 - } - }, - "context": { - "loc": { - "start": { - "line": 1294, - "column": 2, - "index": 35987 - }, - "end": { - "line": 1298, - "column": 3, - "index": 36083 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of frames in the GIF." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "numFrames", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "numFrames", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#numFrames" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Plays an animated GIF that was paused with\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "img.pause()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 1300, - "column": 2, - "index": 36087 - }, - "end": { - "line": 1329, - "column": 5, - "index": 36729 - } - }, - "context": { - "loc": { - "start": { - "line": 1330, - "column": 2, - "index": 36732 - }, - "end": { - "line": 1334, - "column": 3, - "index": 36821 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "play", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "play", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#play" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Pauses an animated GIF. The GIF can be resumed by calling\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "img.play()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 1336, - "column": 2, - "index": 36825 - }, - "end": { - "line": 1365, - "column": 5, - "index": 37480 - } - }, - "context": { - "loc": { - "start": { - "line": 1366, - "column": 2, - "index": 37483 - }, - "end": { - "line": 1370, - "column": 3, - "index": 37574 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pause", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "pause", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#pause" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Changes the delay between frames in an animated GIF." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "index" - }, - { - "type": "text", - "value": ", is optional. If provided, only the frame\nat " - }, - { - "type": "inlineCode", - "value": "index" - }, - { - "type": "text", - "value": " will have its delay modified. All other frames will keep\ntheir default delay." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "delay in milliseconds between switching frames.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "d" - }, - { - "title": "param", - "description": "index of the frame that will have its delay modified.", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "index" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1372, - "column": 2, - "index": 37578 - }, - "end": { - "line": 1428, - "column": 5, - "index": 39043 - } - }, - "context": { - "loc": { - "start": { - "line": 1429, - "column": 2, - "index": 39046 - }, - "end": { - "line": 1441, - "column": 3, - "index": 39366 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "d", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "delay in milliseconds between switching frames." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "index", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "index of the frame that will have its delay modified." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "delay", - "kind": "function", - "memberof": "p5.Image", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "delay", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#delay" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Gets a copy of the element's parent. Returns the parent as another\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.XML" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "element parent", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "p5.XML" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 61, - "column": 2, - "index": 1523 - }, - "end": { - "line": 93, - "column": 3, - "index": 2402 - } - }, - "context": { - "loc": { - "start": { - "line": 94, - "column": 2, - "index": 2405 - }, - "end": { - "line": 96, - "column": 3, - "index": 2469 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.XML.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "element parent" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.XML" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getParent", - "kind": "function", - "memberof": "p5.XML", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "getParent", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#getParent" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Gets the element's full name, which is returned as a String." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "the name of the node", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "<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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 98, - "column": 2, - "index": 2473 - }, - "end": { - "line": 127, - "column": 3, - "index": 3227 - } - }, - "context": { - "loc": { - "start": { - "line": 128, - "column": 2, - "index": 3230 - }, - "end": { - "line": 130, - "column": 3, - "index": 3274 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.XML.js" - }, - "augments": [], - "examples": [ - { - "description": "<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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the name of the node" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getName", - "kind": "function", - "memberof": "p5.XML", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "getName", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#getName" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the element's name, which is specified as a String." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "new name of the node", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "the" - }, - { - "title": "example", - "description": "<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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 132, - "column": 2, - "index": 3278 - }, - "end": { - "line": 164, - "column": 3, - "index": 4094 - } - }, - "context": { - "loc": { - "start": { - "line": 165, - "column": 2, - "index": 4097 - }, - "end": { - "line": 175, - "column": 3, - "index": 4507 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.XML.js" - }, - "augments": [], - "examples": [ - { - "description": "<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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "name", - "lineNumber": 165 - }, - { - "title": "param", - "name": "the", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new name of the node" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setName", - "kind": "function", - "memberof": "p5.XML", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setName", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#setName" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Checks whether or not the element has any children, and returns the result\nas a boolean." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "boolean" - } - }, - { - "title": "example", - "description": "<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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 177, - "column": 2, - "index": 4511 - }, - "end": { - "line": 207, - "column": 3, - "index": 5276 - } - }, - "context": { - "loc": { - "start": { - "line": 208, - "column": 2, - "index": 5279 - }, - "end": { - "line": 210, - "column": 3, - "index": 5339 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.XML.js" - }, - "augments": [], - "examples": [ - { - "description": "<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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "boolean" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "hasChildren", - "kind": "function", - "memberof": "p5.XML", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "hasChildren", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#hasChildren" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "getName()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\non each child element individually." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "names of the children of the element", - "lineNumber": 5, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "example", - "description": "<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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 212, - "column": 2, - "index": 5343 - }, - "end": { - "line": 243, - "column": 3, - "index": 6306 - } - }, - "context": { - "loc": { - "start": { - "line": 244, - "column": 2, - "index": 6309 - }, - "end": { - "line": 250, - "column": 3, - "index": 6479 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.XML.js" - }, - "augments": [], - "examples": [ - { - "description": "<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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "names of the children of the element" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "listChildren", - "kind": "function", - "memberof": "p5.XML", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "listChildren", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#listChildren" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns all of the element's children as an array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.XML" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " objects. When\nthe name parameter is specified, then it will return all children that match\nthat name." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "element name", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "name" - }, - { - "title": "return", - "description": "children of the element", - "lineNumber": 6, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.XML" - } - ] - } - }, - { - "title": "example", - "description": "<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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 252, - "column": 2, - "index": 6483 - }, - "end": { - "line": 290, - "column": 3, - "index": 7555 - } - }, - "context": { - "loc": { - "start": { - "line": 291, - "column": 2, - "index": 7558 - }, - "end": { - "line": 297, - "column": 3, - "index": 7735 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.XML.js" - }, - "augments": [], - "examples": [ - { - "description": "<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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "param", - "lineNumber": 291 - }, - { - "title": "param", - "name": "name", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "element name" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "children of the element" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.XML" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getChildren", - "kind": "function", - "memberof": "p5.XML", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "getChildren", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#getChildren" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "element name or index", - "lineNumber": 5, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "name" - }, - { - "title": "return", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "p5.XML" - } - }, - { - "title": "example", - "description": "<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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 301, - "column": 2, - "index": 7741 - }, - "end": { - "line": 349, - "column": 3, - "index": 8970 - } - }, - "context": { - "loc": { - "start": { - "line": 350, - "column": 2, - "index": 8973 - }, - "end": { - "line": 358, - "column": 3, - "index": 9219 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.XML.js" - }, - "augments": [], - "examples": [ - { - "description": "<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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "param", - "lineNumber": 350 - }, - { - "title": "param", - "name": "name", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "element name or index" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.XML" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getChild", - "kind": "function", - "memberof": "p5.XML", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "getChild", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#getChild" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.XML" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object.\nA reference to the newly created child is returned as an " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.XML" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "a p5.XML Object which will be the child to be added", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "p5.XML" - }, - "name": "node" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 360, - "column": 2, - "index": 9223 - }, - "end": { - "line": 402, - "column": 3, - "index": 10592 - } - }, - "context": { - "loc": { - "start": { - "line": 403, - "column": 2, - "index": 10595 - }, - "end": { - "line": 409, - "column": 3, - "index": 10718 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.XML.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "node", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.XML" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " Object which will be the child to be added" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.XML" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addChild", - "kind": "function", - "memberof": "p5.XML", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "addChild", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#addChild" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes the element specified by name or index." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "element name or index", - "lineNumber": 3, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "name" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 411, - "column": 2, - "index": 10722 - }, - "end": { - "line": 464, - "column": 3, - "index": 11997 - } - }, - "context": { - "loc": { - "start": { - "line": 465, - "column": 2, - "index": 12000 - }, - "end": { - "line": 480, - "column": 3, - "index": 12364 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.XML.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "param", - "lineNumber": 465 - }, - { - "title": "param", - "name": "name", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "element name or index" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeChild", - "kind": "function", - "memberof": "p5.XML", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "removeChild", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#removeChild" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Counts the specified element's number of attributes, returned as an Number." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 482, - "column": 2, - "index": 12368 - }, - "end": { - "line": 512, - "column": 3, - "index": 13163 - } - }, - "context": { - "loc": { - "start": { - "line": 513, - "column": 2, - "index": 13166 - }, - "end": { - "line": 515, - "column": 3, - "index": 13230 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.XML.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getAttributeCount", - "kind": "function", - "memberof": "p5.XML", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "getAttributeCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#getAttributeCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Gets all of the specified element's attributes, and returns them as an\narray of Strings." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "an array of strings containing the names of attributes", - "lineNumber": 4, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 517, - "column": 2, - "index": 13234 - }, - "end": { - "line": 548, - "column": 3, - "index": 14114 - } - }, - "context": { - "loc": { - "start": { - "line": 549, - "column": 2, - "index": 14117 - }, - "end": { - "line": 557, - "column": 3, - "index": 14270 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.XML.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "an array of strings containing the names of attributes" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "listAttributes", - "kind": "function", - "memberof": "p5.XML", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "listAttributes", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#listAttributes" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Checks whether or not an element has the specified attribute." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "attribute to be checked", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "the" - }, - { - "title": "return", - "description": "true if attribute found else false", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "boolean" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 559, - "column": 2, - "index": 14274 - }, - "end": { - "line": 592, - "column": 3, - "index": 15203 - } - }, - "context": { - "loc": { - "start": { - "line": 593, - "column": 2, - "index": 15206 - }, - "end": { - "line": 601, - "column": 3, - "index": 15399 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.XML.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "name", - "lineNumber": 593 - }, - { - "title": "param", - "name": "the", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "attribute to be checked" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "true if attribute found else false" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "boolean" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "hasAttribute", - "kind": "function", - "memberof": "p5.XML", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "hasAttribute", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#hasAttribute" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "the non-null full name of the attribute", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "name" - }, - { - "title": "param", - "description": "the default value of the attribute", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "defaultValue" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 603, - "column": 2, - "index": 15403 - }, - "end": { - "line": 638, - "column": 3, - "index": 16521 - } - }, - "context": { - "loc": { - "start": { - "line": 639, - "column": 2, - "index": 16524 - }, - "end": { - "line": 647, - "column": 3, - "index": 16739 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.XML.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "name", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the non-null full name of the attribute" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "defaultValue", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the default value of the attribute" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getNum", - "kind": "function", - "memberof": "p5.XML", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "getNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#getNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "the non-null full name of the attribute", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "name" - }, - { - "title": "param", - "description": "the default value of the attribute", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "defaultValue" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 649, - "column": 2, - "index": 16743 - }, - "end": { - "line": 684, - "column": 3, - "index": 17875 - } - }, - "context": { - "loc": { - "start": { - "line": 685, - "column": 2, - "index": 17878 - }, - "end": { - "line": 693, - "column": 3, - "index": 18110 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.XML.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "name", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the non-null full name of the attribute" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "defaultValue", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the default value of the attribute" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getString", - "kind": "function", - "memberof": "p5.XML", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "getString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#getString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the content of an element's attribute. The first parameter specifies\nthe attribute name, while the second specifies the new content." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "the full name of the attribute", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "name" - }, - { - "title": "param", - "description": "the value of the attribute", - "lineNumber": 5, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 695, - "column": 2, - "index": 18114 - }, - "end": { - "line": 730, - "column": 3, - "index": 19226 - } - }, - "context": { - "loc": { - "start": { - "line": 731, - "column": 2, - "index": 19229 - }, - "end": { - "line": 733, - "column": 3, - "index": 19300 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.XML.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "name", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the full name of the attribute" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the value of the attribute" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setAttribute", - "kind": "function", - "memberof": "p5.XML", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setAttribute", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#setAttribute" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the content of an element. If there is no such content,\ndefaultValue is returned if specified, otherwise null is returned." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "value returned if no content is found", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "defaultValue" - }, - { - "title": "return", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 735, - "column": 2, - "index": 19304 - }, - "end": { - "line": 767, - "column": 3, - "index": 20226 - } - }, - "context": { - "loc": { - "start": { - "line": 768, - "column": 2, - "index": 20229 - }, - "end": { - "line": 773, - "column": 3, - "index": 20382 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.XML.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "defaultValue", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value returned if no content is found" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getContent", - "kind": "function", - "memberof": "p5.XML", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "getContent", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#getContent" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the element's content." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "the new content", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "text" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 775, - "column": 2, - "index": 20386 - }, - "end": { - "line": 808, - "column": 3, - "index": 21254 - } - }, - "context": { - "loc": { - "start": { - "line": 809, - "column": 2, - "index": 21257 - }, - "end": { - "line": 813, - "column": 3, - "index": 21363 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.XML.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "content", - "lineNumber": 809 - }, - { - "title": "param", - "name": "text", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the new content" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setContent", - "kind": "function", - "memberof": "p5.XML", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setContent", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#setContent" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Serialized string of the element", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 815, - "column": 2, - "index": 21367 - }, - "end": { - "line": 839, - "column": 3, - "index": 22022 - } - }, - "context": { - "loc": { - "start": { - "line": 840, - "column": 2, - "index": 22025 - }, - "end": { - "line": 843, - "column": 3, - "index": 22143 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.XML.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Serialized string of the element" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "serialize", - "kind": "function", - "memberof": "p5.XML", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "serialize", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#serialize" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a string representation of a vector. This method is useful for\nprinting vectors to the console while debugging." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "string representation of the vector.", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\n\nfunction setup() {\n let v = createVector(20, 30);\n // Prints 'p5.Vector Object : [20, 30, 0]'.\n print(v.toString());\n}\n\n
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 117, - "column": 4, - "index": 3175 - }, - "end": { - "line": 131, - "column": 5, - "index": 3601 - } - }, - "context": { - "loc": { - "start": { - "line": 132, - "column": 4, - "index": 3606 - }, - "end": { - "line": 134, - "column": 5, - "index": 3693 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nfunction setup() {\n let v = createVector(20, 30);\n // Prints 'p5.Vector Object : [20, 30, 0]'.\n print(v.toString());\n}\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "string representation of the vector." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "toString", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "toString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#toString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the " - }, - { - "type": "inlineCode", - "value": "x" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "y" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "z" - }, - { - "type": "text", - "value": " components of the vector using separate numbers,\na " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, or an array of numbers.\nCalling " - }, - { - "type": "inlineCode", - "value": "set()" - }, - { - "type": "text", - "value": " with no arguments sets the vector's components to 0." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "x component of the vector.", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "x" - }, - { - "title": "param", - "description": "y component of the vector.", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "y" - }, - { - "title": "param", - "description": "z component of the vector.", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "z" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 136, - "column": 4, - "index": 3699 - }, - "end": { - "line": 171, - "column": 5, - "index": 4606 - } - }, - "context": { - "loc": { - "start": { - "line": 176, - "column": 4, - "index": 4695 - }, - "end": { - "line": 193, - "column": 5, - "index": 5093 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x component of the vector." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y component of the vector." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z component of the vector." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "set", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "set", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#set" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": "vector to set.", - "lineNumber": 1, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - }, - "name": "value" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 2 - } - ], - "loc": { - "start": { - "line": 172, - "column": 4, - "index": 4611 - }, - "end": { - "line": 175, - "column": 5, - "index": 4690 - } - }, - "context": { - "loc": { - "start": { - "line": 176, - "column": 4, - "index": 4695 - }, - "end": { - "line": 193, - "column": 5, - "index": 5093 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 176 - }, - { - "title": "param", - "name": "y", - "lineNumber": 176 - }, - { - "title": "param", - "name": "z", - "lineNumber": 176 - }, - { - "title": "param", - "name": "value", - "lineNumber": 1, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "vector to set." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "set", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "set", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#set" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a copy of the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "copy of the p5.Vector object.", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 195, - "column": 4, - "index": 5099 - }, - "end": { - "line": 211, - "column": 5, - "index": 5508 - } - }, - "context": { - "loc": { - "start": { - "line": 212, - "column": 4, - "index": 5513 - }, - "end": { - "line": 224, - "column": 5, - "index": 5781 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "copy of the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "copy", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "copy", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#copy" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Adds to a vector's " - }, - { - "type": "inlineCode", - "value": "x" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "y" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "z" - }, - { - "type": "text", - "value": " components using separate numbers,\nanother " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, or an array of numbers.\nCalling " - }, - { - "type": "inlineCode", - "value": "add()" - }, - { - "type": "text", - "value": " with no arguments has no effect." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The static version of " - }, - { - "type": "inlineCode", - "value": "add()" - }, - { - "type": "text", - "value": ", as in " - }, - { - "type": "inlineCode", - "value": "p5.Vector.add(v2, v1)" - }, - { - "type": "text", - "value": ", returns a new\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object and doesn't change the\noriginals." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "x component of the vector to be added.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y component of the vector to be added.", - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "y" - }, - { - "title": "param", - "description": "z component of the vector to be added.", - "lineNumber": 11, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "z" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 12 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 226, - "column": 4, - "index": 5787 - }, - "end": { - "line": 319, - "column": 5, - "index": 8303 - } - }, - "context": { - "loc": { - "start": { - "line": 324, - "column": 4, - "index": 8396 - }, - "end": { - "line": 341, - "column": 5, - "index": 8803 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x component of the vector to be added." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y component of the vector to be added." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z component of the vector to be added." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "add", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "add", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#add" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": "The vector to add", - "lineNumber": 1, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - }, - "name": "value" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 2 - } - ], - "loc": { - "start": { - "line": 320, - "column": 4, - "index": 8308 - }, - "end": { - "line": 323, - "column": 5, - "index": 8391 - } - }, - "context": { - "loc": { - "start": { - "line": 324, - "column": 4, - "index": 8396 - }, - "end": { - "line": 341, - "column": 5, - "index": 8803 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 324 - }, - { - "title": "param", - "name": "y", - "lineNumber": 324 - }, - { - "title": "param", - "name": "z", - "lineNumber": 324 - }, - { - "title": "param", - "name": "value", - "lineNumber": 1, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The vector to add" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "add", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "add", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#add" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Performs modulo (remainder) division with a vector's " - }, - { - "type": "inlineCode", - "value": "x" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "y" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "z" - }, - { - "type": "text", - "value": "\ncomponents using separate numbers, another\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, or an array of numbers." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The static version of " - }, - { - "type": "inlineCode", - "value": "rem()" - }, - { - "type": "text", - "value": " as in " - }, - { - "type": "inlineCode", - "value": "p5.Vector.rem(v2, v1)" - }, - { - "type": "text", - "value": ", returns a new\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object and doesn't change the\noriginals." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "x component of divisor vector.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y component of divisor vector.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "z component of divisor vector.", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 12 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 343, - "column": 4, - "index": 8809 - }, - "end": { - "line": 398, - "column": 5, - "index": 10306 - } - }, - "context": { - "loc": { - "start": { - "line": 403, - "column": 4, - "index": 10400 - }, - "end": { - "line": 456, - "column": 5, - "index": 12216 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x component of divisor vector." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y component of divisor vector." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z component of divisor vector." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rem", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "rem", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#rem" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": "divisor vector.", - "lineNumber": 1, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - }, - "name": "value" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 2 - } - ], - "loc": { - "start": { - "line": 399, - "column": 4, - "index": 10311 - }, - "end": { - "line": 402, - "column": 5, - "index": 10395 - } - }, - "context": { - "loc": { - "start": { - "line": 403, - "column": 4, - "index": 10400 - }, - "end": { - "line": 456, - "column": 5, - "index": 12216 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 403 - }, - { - "title": "param", - "name": "y", - "lineNumber": 403 - }, - { - "title": "param", - "name": "z", - "lineNumber": 403 - }, - { - "title": "param", - "name": "value", - "lineNumber": 1, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "divisor vector." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rem", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "rem", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#rem" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Subtracts from a vector's " - }, - { - "type": "inlineCode", - "value": "x" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "y" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "z" - }, - { - "type": "text", - "value": " components using separate\nnumbers, another " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, or an array of\nnumbers. Calling " - }, - { - "type": "inlineCode", - "value": "sub()" - }, - { - "type": "text", - "value": " with no arguments has no effect." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The static version of " - }, - { - "type": "inlineCode", - "value": "sub()" - }, - { - "type": "text", - "value": ", as in " - }, - { - "type": "inlineCode", - "value": "p5.Vector.sub(v2, v1)" - }, - { - "type": "text", - "value": ", returns a new\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object and doesn't change the\noriginals." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "x component of the vector to subtract.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y component of the vector to subtract.", - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "y" - }, - { - "title": "param", - "description": "z component of the vector to subtract.", - "lineNumber": 11, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "z" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 12 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 458, - "column": 4, - "index": 12222 - }, - "end": { - "line": 551, - "column": 5, - "index": 14695 - } - }, - "context": { - "loc": { - "start": { - "line": 556, - "column": 4, - "index": 14793 - }, - "end": { - "line": 573, - "column": 5, - "index": 15199 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x component of the vector to subtract." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y component of the vector to subtract." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z component of the vector to subtract." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "sub", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "sub", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#sub" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": "the vector to subtract", - "lineNumber": 1, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - }, - "name": "value" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 2 - } - ], - "loc": { - "start": { - "line": 552, - "column": 4, - "index": 14700 - }, - "end": { - "line": 555, - "column": 5, - "index": 14788 - } - }, - "context": { - "loc": { - "start": { - "line": 556, - "column": 4, - "index": 14793 - }, - "end": { - "line": 573, - "column": 5, - "index": 15199 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 556 - }, - { - "title": "param", - "name": "y", - "lineNumber": 556 - }, - { - "title": "param", - "name": "z", - "lineNumber": 556 - }, - { - "title": "param", - "name": "value", - "lineNumber": 1, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the vector to subtract" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "sub", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "sub", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#sub" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Multiplies a vector's " - }, - { - "type": "inlineCode", - "value": "x" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "y" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "z" - }, - { - "type": "text", - "value": " components by the same number,\nseparate numbers, the components of another\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, or an array of numbers. Calling\n" - }, - { - "type": "inlineCode", - "value": "mult()" - }, - { - "type": "text", - "value": " with no arguments has no effect." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The static version of " - }, - { - "type": "inlineCode", - "value": "mult()" - }, - { - "type": "text", - "value": ", as in " - }, - { - "type": "inlineCode", - "value": "p5.Vector.mult(v, 2)" - }, - { - "type": "text", - "value": ", returns a new\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object and doesn't change the\noriginals." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The number to multiply with the vector", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "n" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 575, - "column": 4, - "index": 15205 - }, - "end": { - "line": 691, - "column": 5, - "index": 18176 - } - }, - "context": { - "loc": { - "start": { - "line": 710, - "column": 4, - "index": 18685 - }, - "end": { - "line": 787, - "column": 5, - "index": 20938 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 710 - }, - { - "title": "param", - "name": "y", - "lineNumber": 710 - }, - { - "title": "param", - "name": "z", - "lineNumber": 710 - }, - { - "title": "param", - "name": "n", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The number to multiply with the vector" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mult", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mult", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#mult" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": "number to multiply with the x component of the vector.", - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "number to multiply with the y component of the vector.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "number to multiply with the z component of the vector.", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "z" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 693, - "column": 4, - "index": 18182 - }, - "end": { - "line": 698, - "column": 5, - "index": 18446 - } - }, - "context": { - "loc": { - "start": { - "line": 710, - "column": 4, - "index": 18685 - }, - "end": { - "line": 787, - "column": 5, - "index": 20938 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 1, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number to multiply with the x component of the vector." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number to multiply with the y component of the vector." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number to multiply with the z component of the vector." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mult", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mult", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#mult" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": "array to multiply with the components of the vector.", - "lineNumber": 1, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "arr" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 2 - } - ], - "loc": { - "start": { - "line": 700, - "column": 4, - "index": 18452 - }, - "end": { - "line": 703, - "column": 5, - "index": 18558 - } - }, - "context": { - "loc": { - "start": { - "line": 710, - "column": 4, - "index": 18685 - }, - "end": { - "line": 787, - "column": 5, - "index": 20938 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 710 - }, - { - "title": "param", - "name": "y", - "lineNumber": 710 - }, - { - "title": "param", - "name": "z", - "lineNumber": 710 - }, - { - "title": "param", - "name": "arr", - "lineNumber": 1, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "array to multiply with the components of the vector." - } - ] - } - ] - }, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mult", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mult", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#mult" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": "vector to multiply with the components of the original vector.", - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 2 - } - ], - "loc": { - "start": { - "line": 705, - "column": 4, - "index": 18564 - }, - "end": { - "line": 708, - "column": 5, - "index": 18679 - } - }, - "context": { - "loc": { - "start": { - "line": 710, - "column": 4, - "index": 18685 - }, - "end": { - "line": 787, - "column": 5, - "index": 20938 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 710 - }, - { - "title": "param", - "name": "y", - "lineNumber": 710 - }, - { - "title": "param", - "name": "z", - "lineNumber": 710 - }, - { - "title": "param", - "name": "v", - "lineNumber": 1, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "vector to multiply with the components of the original vector." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mult", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mult", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#mult" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Divides a vector's " - }, - { - "type": "inlineCode", - "value": "x" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "y" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "z" - }, - { - "type": "text", - "value": " components by the same number,\nseparate numbers, the components of another\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, or an array of numbers. Calling\n" - }, - { - "type": "inlineCode", - "value": "div()" - }, - { - "type": "text", - "value": " with no arguments has no effect." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The static version of " - }, - { - "type": "inlineCode", - "value": "div()" - }, - { - "type": "text", - "value": ", as in " - }, - { - "type": "inlineCode", - "value": "p5.Vector.div(v, 2)" - }, - { - "type": "text", - "value": ", returns a new\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object and doesn't change the\noriginals." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The number to divide the vector by", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "number" - }, - "name": "n" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 789, - "column": 4, - "index": 20944 - }, - "end": { - "line": 905, - "column": 5, - "index": 23901 - } - }, - "context": { - "loc": { - "start": { - "line": 923, - "column": 4, - "index": 24395 - }, - "end": { - "line": 1018, - "column": 5, - "index": 27243 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 923 - }, - { - "title": "param", - "name": "y", - "lineNumber": 923 - }, - { - "title": "param", - "name": "z", - "lineNumber": 923 - }, - { - "title": "param", - "name": "n", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The number to divide the vector by" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "div", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "div", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#div" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": "number to divide with the x component of the vector.", - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "number to divide with the y component of the vector.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "number to divide with the z component of the vector.", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "z" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 907, - "column": 4, - "index": 23907 - }, - "end": { - "line": 912, - "column": 5, - "index": 24165 - } - }, - "context": { - "loc": { - "start": { - "line": 923, - "column": 4, - "index": 24395 - }, - "end": { - "line": 1018, - "column": 5, - "index": 27243 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 1, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number to divide with the x component of the vector." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number to divide with the y component of the vector." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number to divide with the z component of the vector." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "div", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "div", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#div" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": "array to divide the components of the vector by.", - "lineNumber": 1, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "arr" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 2 - } - ], - "loc": { - "start": { - "line": 914, - "column": 4, - "index": 24171 - }, - "end": { - "line": 917, - "column": 5, - "index": 24273 - } - }, - "context": { - "loc": { - "start": { - "line": 923, - "column": 4, - "index": 24395 - }, - "end": { - "line": 1018, - "column": 5, - "index": 27243 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 923 - }, - { - "title": "param", - "name": "y", - "lineNumber": 923 - }, - { - "title": "param", - "name": "z", - "lineNumber": 923 - }, - { - "title": "param", - "name": "arr", - "lineNumber": 1, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "array to divide the components of the vector by." - } - ] - } - ] - }, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "div", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "div", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#div" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": "vector to divide the components of the original vector by.", - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 2 - } - ], - "loc": { - "start": { - "line": 919, - "column": 4, - "index": 24279 - }, - "end": { - "line": 922, - "column": 5, - "index": 24390 - } - }, - "context": { - "loc": { - "start": { - "line": 923, - "column": 4, - "index": 24395 - }, - "end": { - "line": 1018, - "column": 5, - "index": 27243 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 923 - }, - { - "title": "param", - "name": "y", - "lineNumber": 923 - }, - { - "title": "param", - "name": "z", - "lineNumber": 923 - }, - { - "title": "param", - "name": "v", - "lineNumber": 1, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "vector to divide the components of the original vector by." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "div", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "div", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#div" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the magnitude (length) of the vector." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "magnitude of the vector.", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 1019, - "column": 4, - "index": 27248 - }, - "end": { - "line": 1035, - "column": 5, - "index": 27680 - } - }, - "context": { - "loc": { - "start": { - "line": 1036, - "column": 4, - "index": 27685 - }, - "end": { - "line": 1038, - "column": 5, - "index": 27736 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "magnitude of the vector." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mag", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mag", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#mag" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the magnitude (length) of the vector squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "squared magnitude of the vector.", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 1040, - "column": 4, - "index": 27742 - }, - "end": { - "line": 1056, - "column": 5, - "index": 28194 - } - }, - "context": { - "loc": { - "start": { - "line": 1057, - "column": 4, - "index": 28199 - }, - "end": { - "line": 1062, - "column": 5, - "index": 28322 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "squared magnitude of the vector." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "magSq", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "magSq", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#magSq" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "dot()" - }, - { - "type": "text", - "value": " with one parameter interprets it as another\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "dot()" - }, - { - "type": "text", - "value": " with multiple parameters interprets them as the\n" - }, - { - "type": "inlineCode", - "value": "x" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "y" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "z" - }, - { - "type": "text", - "value": " components of another vector." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The static version of " - }, - { - "type": "inlineCode", - "value": "dot()" - }, - { - "type": "text", - "value": ", as in " - }, - { - "type": "inlineCode", - "value": "p5.Vector.dot(v1, v2)" - }, - { - "type": "text", - "value": ", is the same\nas calling " - }, - { - "type": "inlineCode", - "value": "v1.dot(v2)" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "x component of the vector.", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y component of the vector.", - "lineNumber": 17, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "y" - }, - { - "title": "param", - "description": "z component of the vector.", - "lineNumber": 18, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "z" - }, - { - "title": "return", - "description": "dot product.", - "lineNumber": 19, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 21 - } - ], - "loc": { - "start": { - "line": 1064, - "column": 4, - "index": 28328 - }, - "end": { - "line": 1139, - "column": 5, - "index": 30752 - } - }, - "context": { - "loc": { - "start": { - "line": 1144, - "column": 4, - "index": 30870 - }, - "end": { - "line": 1149, - "column": 5, - "index": 31046 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x component of the vector." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y component of the vector." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z component of the vector." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "dot product." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dot", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "dot", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#dot" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": "p5.Vector to be dotted.", - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v" - }, - { - "title": "return", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "loc": { - "start": { - "line": 1140, - "column": 4, - "index": 30757 - }, - "end": { - "line": 1143, - "column": 5, - "index": 30865 - } - }, - "context": { - "loc": { - "start": { - "line": 1144, - "column": 4, - "index": 30870 - }, - "end": { - "line": 1149, - "column": 5, - "index": 31046 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 1144 - }, - { - "title": "param", - "name": "y", - "lineNumber": 1144 - }, - { - "title": "param", - "name": "z", - "lineNumber": 1144 - }, - { - "title": "param", - "name": "v", - "lineNumber": 1, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to be dotted." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dot", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "dot", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#dot" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The static version of " - }, - { - "type": "inlineCode", - "value": "cross()" - }, - { - "type": "text", - "value": ", as in " - }, - { - "type": "inlineCode", - "value": "p5.Vector.cross(v1, v2)" - }, - { - "type": "text", - "value": ", is the same\nas calling " - }, - { - "type": "inlineCode", - "value": "v1.cross(v2)" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "p5.Vector to be crossed.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v" - }, - { - "title": "return", - "description": "cross product as a p5.Vector.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 1151, - "column": 4, - "index": 31052 - }, - "end": { - "line": 1182, - "column": 5, - "index": 32130 - } - }, - "context": { - "loc": { - "start": { - "line": 1183, - "column": 4, - "index": 32135 - }, - "end": { - "line": 1192, - "column": 5, - "index": 32449 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to be crossed." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "cross product as a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "cross", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "cross", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#cross" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the distance between two points represented by vectors. A point's\ncoordinates can be thought of as a vector's components." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The static version of " - }, - { - "type": "inlineCode", - "value": "dist()" - }, - { - "type": "text", - "value": ", as in " - }, - { - "type": "inlineCode", - "value": "p5.Vector.dist(v1, v2)" - }, - { - "type": "text", - "value": ", is the same\nas calling " - }, - { - "type": "inlineCode", - "value": "v1.dist(v2)" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "dist()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to calculate the distance between points\nusing coordinates as in " - }, - { - "type": "inlineCode", - "value": "dist(x1, y1, x2, y2)" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "x, y, and z coordinates of a p5.Vector.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v" - }, - { - "title": "return", - "description": "distance.", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 1194, - "column": 4, - "index": 32455 - }, - "end": { - "line": 1263, - "column": 5, - "index": 34549 - } - }, - "context": { - "loc": { - "start": { - "line": 1264, - "column": 4, - "index": 34554 - }, - "end": { - "line": 1269, - "column": 5, - "index": 34635 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x, y, and z coordinates of a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "distance." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dist", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "dist", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#dist" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Scales the components of a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object so\nthat its magnitude is 1." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The static version of " - }, - { - "type": "inlineCode", - "value": "normalize()" - }, - { - "type": "text", - "value": ", as in " - }, - { - "type": "inlineCode", - "value": "p5.Vector.normalize(v)" - }, - { - "type": "text", - "value": ",\nreturns a new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object and doesn't change\nthe original." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "normalized p5.Vector.", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 1271, - "column": 4, - "index": 34641 - }, - "end": { - "line": 1335, - "column": 5, - "index": 36556 - } - }, - "context": { - "loc": { - "start": { - "line": 1336, - "column": 4, - "index": 36561 - }, - "end": { - "line": 1342, - "column": 5, - "index": 36788 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "normalized " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "normalize", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "normalize", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#normalize" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Limits a vector's magnitude to a maximum value." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The static version of " - }, - { - "type": "inlineCode", - "value": "limit()" - }, - { - "type": "text", - "value": ", as in " - }, - { - "type": "inlineCode", - "value": "p5.Vector.limit(v, 5)" - }, - { - "type": "text", - "value": ", returns a\nnew " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object and doesn't change the\noriginal." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "maximum magnitude for the vector.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "max" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 1344, - "column": 4, - "index": 36794 - }, - "end": { - "line": 1405, - "column": 5, - "index": 38528 - } - }, - "context": { - "loc": { - "start": { - "line": 1406, - "column": 4, - "index": 38533 - }, - "end": { - "line": 1413, - "column": 5, - "index": 38709 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "max", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "maximum magnitude for the vector." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "limit", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "limit", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#limit" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets a vector's magnitude to a given value." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The static version of " - }, - { - "type": "inlineCode", - "value": "setMag()" - }, - { - "type": "text", - "value": ", as in " - }, - { - "type": "inlineCode", - "value": "p5.Vector.setMag(v, 10)" - }, - { - "type": "text", - "value": ", returns\na new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object and doesn't change the\noriginal." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "new length for this vector.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "number" - }, - "name": "len" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 1415, - "column": 4, - "index": 38715 - }, - "end": { - "line": 1479, - "column": 5, - "index": 40470 - } - }, - "context": { - "loc": { - "start": { - "line": 1480, - "column": 4, - "index": 40475 - }, - "end": { - "line": 1482, - "column": 5, - "index": 40531 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n", - "lineNumber": 1480 - }, - { - "title": "param", - "name": "len", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new length for this vector." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setMag", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setMag", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#setMag" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates the angle a 2D vector makes with the positive x-axis. Angles\nincrease in the clockwise direction." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If the vector was created with\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createVector()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "heading()" - }, - { - "type": "text", - "value": " returns angles\nin the units of the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The static version of " - }, - { - "type": "inlineCode", - "value": "heading()" - }, - { - "type": "text", - "value": ", as in " - }, - { - "type": "inlineCode", - "value": "p5.Vector.heading(v)" - }, - { - "type": "text", - "value": ", works the\nsame way." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "angle of rotation.", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 1484, - "column": 4, - "index": 40537 - }, - "end": { - "line": 1556, - "column": 5, - "index": 42554 - } - }, - "context": { - "loc": { - "start": { - "line": 1557, - "column": 4, - "index": 42559 - }, - "end": { - "line": 1561, - "column": 5, - "index": 42689 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "angle of rotation." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "heading", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "heading", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#heading" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If the vector was created with\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createVector()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "setHeading()" - }, - { - "type": "text", - "value": " uses\nthe units of the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "angle of rotation.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "number" - }, - "name": "angle" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 1563, - "column": 4, - "index": 42695 - }, - "end": { - "line": 1631, - "column": 5, - "index": 44530 - } - }, - "context": { - "loc": { - "start": { - "line": 1633, - "column": 4, - "index": 44536 - }, - "end": { - "line": 1639, - "column": 5, - "index": 44714 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "a", - "lineNumber": 1633 - }, - { - "title": "param", - "name": "angle", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "angle of rotation." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setHeading", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setHeading", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#setHeading" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If the vector was created with\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createVector()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "rotate()" - }, - { - "type": "text", - "value": " uses\nthe units of the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The static version of " - }, - { - "type": "inlineCode", - "value": "rotate()" - }, - { - "type": "text", - "value": ", as in " - }, - { - "type": "inlineCode", - "value": "p5.Vector.rotate(v, PI)" - }, - { - "type": "text", - "value": ",\nreturns a new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object and doesn't change\nthe original." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "angle of rotation.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "number" - }, - "name": "angle" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 14 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 15 - } - ], - "loc": { - "start": { - "line": 1641, - "column": 4, - "index": 44720 - }, - "end": { - "line": 1738, - "column": 5, - "index": 47464 - } - }, - "context": { - "loc": { - "start": { - "line": 1739, - "column": 4, - "index": 47469 - }, - "end": { - "line": 1746, - "column": 5, - "index": 47730 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "a", - "lineNumber": 1739 - }, - { - "title": "param", - "name": "angle", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "angle of rotation." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotate", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "rotate", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#rotate" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the angle between two vectors. The angles returned are signed,\nwhich means that " - }, - { - "type": "inlineCode", - "value": "v1.angleBetween(v2) === -v2.angleBetween(v1)" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If the vector was created with\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createVector()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "angleBetween()" - }, - { - "type": "text", - "value": " returns\nangles in the units of the current\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "x, y, and z components of a p5.Vector.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "value" - }, - { - "title": "return", - "description": "angle between the vectors.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 1748, - "column": 4, - "index": 47736 - }, - "end": { - "line": 1843, - "column": 5, - "index": 50629 - } - }, - "context": { - "loc": { - "start": { - "line": 1844, - "column": 4, - "index": 50634 - }, - "end": { - "line": 1859, - "column": 5, - "index": 51264 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 1844 - }, - { - "title": "param", - "name": "value", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x, y, and z components of a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "angle between the vectors." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "angleBetween", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "angleBetween", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#angleBetween" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates new " - }, - { - "type": "inlineCode", - "value": "x" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "y" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "z" - }, - { - "type": "text", - "value": " components that are proportionally the\nsame distance between two vectors. The " - }, - { - "type": "inlineCode", - "value": "amt" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The static version of " - }, - { - "type": "inlineCode", - "value": "lerp()" - }, - { - "type": "text", - "value": ", as in " - }, - { - "type": "inlineCode", - "value": "p5.Vector.lerp(v0, v1, 0.5)" - }, - { - "type": "text", - "value": ",\nreturns a new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object and doesn't change\nthe original." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "x component.", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y component.", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "z component.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z" - }, - { - "title": "param", - "description": "amount of interpolation between 0.0 (old vector)\n and 1.0 (new vector). 0.5 is halfway between.", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "amt" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 16 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 18 - } - ], - "loc": { - "start": { - "line": 1861, - "column": 4, - "index": 51270 - }, - "end": { - "line": 1941, - "column": 5, - "index": 53834 - } - }, - "context": { - "loc": { - "start": { - "line": 1947, - "column": 4, - "index": 53978 - }, - "end": { - "line": 1955, - "column": 5, - "index": 54234 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x component." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y component." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z component." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "amt", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "amount of interpolation between 0.0 (old vector)\nand 1.0 (new vector). 0.5 is halfway between." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "lerp", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "lerp", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#lerp" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": "p5.Vector to lerp toward.", - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "amt" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 1942, - "column": 4, - "index": 53839 - }, - "end": { - "line": 1946, - "column": 5, - "index": 53973 - } - }, - "context": { - "loc": { - "start": { - "line": 1947, - "column": 4, - "index": 53978 - }, - "end": { - "line": 1955, - "column": 5, - "index": 54234 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 1947 - }, - { - "title": "param", - "name": "y", - "lineNumber": 1947 - }, - { - "title": "param", - "name": "z", - "lineNumber": 1947 - }, - { - "title": "param", - "name": "amt", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v", - "lineNumber": 1, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to lerp toward." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "lerp", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "lerp", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#lerp" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates a new heading and magnitude that are between two vectors. The\n" - }, - { - "type": "inlineCode", - "value": "amt" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "slerp()" - }, - { - "type": "text", - "value": " differs from " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "lerp()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " because\nit interpolates magnitude. Calling " - }, - { - "type": "inlineCode", - "value": "v0.slerp(v1, 0.5)" - }, - { - "type": "text", - "value": " sets " - }, - { - "type": "inlineCode", - "value": "v0" - }, - { - "type": "text", - "value": "'s\nmagnitude to a value halfway between its original magnitude and " - }, - { - "type": "inlineCode", - "value": "v1" - }, - { - "type": "text", - "value": "'s.\nCalling " - }, - { - "type": "inlineCode", - "value": "v0.lerp(v1, 0.5)" - }, - { - "type": "text", - "value": " makes no such guarantee." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The static version of " - }, - { - "type": "inlineCode", - "value": "slerp()" - }, - { - "type": "text", - "value": ", as in " - }, - { - "type": "inlineCode", - "value": "p5.Vector.slerp(v0, v1, 0.5)" - }, - { - "type": "text", - "value": ",\nreturns a new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object and doesn't change\nthe original." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "p5.Vector to slerp toward.", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v" - }, - { - "title": "param", - "description": "amount of interpolation between 0.0 (old vector)\n and 1.0 (new vector). 0.5 is halfway between.", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "amt" - }, - { - "title": "return", - "description": null, - "lineNumber": 19, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 21 - } - ], - "loc": { - "start": { - "line": 1957, - "column": 4, - "index": 54240 - }, - "end": { - "line": 2055, - "column": 5, - "index": 57379 - } - }, - "context": { - "loc": { - "start": { - "line": 2056, - "column": 4, - "index": 57384 - }, - "end": { - "line": 2120, - "column": 5, - "index": 60067 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to slerp toward." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "amt", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "amount of interpolation between 0.0 (old vector)\nand 1.0 (new vector). 0.5 is halfway between." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "slerp", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "slerp", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#slerp" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The static version of " - }, - { - "type": "inlineCode", - "value": "reflect()" - }, - { - "type": "text", - "value": ", as in " - }, - { - "type": "inlineCode", - "value": "p5.Vector.reflect(v, n)" - }, - { - "type": "text", - "value": ",\nreturns a new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object and doesn't change\nthe original." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "p5.Vector\n to reflect about.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "surfaceNormal" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 2122, - "column": 4, - "index": 60073 - }, - "end": { - "line": 2190, - "column": 5, - "index": 62160 - } - }, - "context": { - "loc": { - "start": { - "line": 2191, - "column": 4, - "index": 62165 - }, - "end": { - "line": 2194, - "column": 5, - "index": 62300 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "surfaceNormal", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nto reflect about." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "reflect", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "reflect", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#reflect" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the vector's components as an array of numbers." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "array with the vector's components.", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "example", - "description": "
\n\nlet v = createVector(20, 30);\n// Prints \"[20, 30, 0]\" to the console.\nprint(v.array());\n\n
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 2196, - "column": 4, - "index": 62306 - }, - "end": { - "line": 2208, - "column": 5, - "index": 62625 - } - }, - "context": { - "loc": { - "start": { - "line": 2209, - "column": 4, - "index": 62630 - }, - "end": { - "line": 2211, - "column": 5, - "index": 62699 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nlet v = createVector(20, 30);\n// Prints \"[20, 30, 0]\" to the console.\nprint(v.array());\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "array with the vector's components." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "array", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "array", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#array" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": " if the vector's components are all the same as another\nvector's and " - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " if not." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "equals()" - }, - { - "type": "text", - "value": " with one parameter interprets it as another\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "equals()" - }, - { - "type": "text", - "value": " with multiple parameters interprets them as the\ncomponents of another vector. Any missing parameters are assigned the value\n0." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The static version of " - }, - { - "type": "inlineCode", - "value": "equals()" - }, - { - "type": "text", - "value": ", as in " - }, - { - "type": "inlineCode", - "value": "p5.Vector.equals(v0, v1)" - }, - { - "type": "text", - "value": ",\ninterprets both parameters as " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " objects." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "x component of the vector.", - "lineNumber": 14, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "x" - }, - { - "title": "param", - "description": "y component of the vector.", - "lineNumber": 15, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "y" - }, - { - "title": "param", - "description": "z component of the vector.", - "lineNumber": 16, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "z" - }, - { - "title": "return", - "description": "whether the vectors are equal.", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 18 - } - ], - "loc": { - "start": { - "line": 2213, - "column": 4, - "index": 62705 - }, - "end": { - "line": 2270, - "column": 5, - "index": 64529 - } - }, - "context": { - "loc": { - "start": { - "line": 2275, - "column": 4, - "index": 64626 - }, - "end": { - "line": 2291, - "column": 5, - "index": 65018 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x component of the vector." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y component of the vector." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z component of the vector." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "whether the vectors are equal." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "equals", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "equals", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#equals" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": "vector to compare.", - "lineNumber": 1, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "NameExpression", - "name": "Array" - } - ] - }, - "name": "value" - }, - { - "title": "return", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "loc": { - "start": { - "line": 2271, - "column": 4, - "index": 64534 - }, - "end": { - "line": 2274, - "column": 5, - "index": 64621 - } - }, - "context": { - "loc": { - "start": { - "line": 2275, - "column": 4, - "index": 64626 - }, - "end": { - "line": 2291, - "column": 5, - "index": 65018 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 2275 - }, - { - "title": "param", - "name": "y", - "lineNumber": 2275 - }, - { - "title": "param", - "name": "z", - "lineNumber": 2275 - }, - { - "title": "param", - "name": "value", - "lineNumber": 1, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "vector to compare." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "NameExpression", - "name": "Array" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "equals", - "kind": "function", - "memberof": "p5.Vector", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "equals", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#equals" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Make a new 2D vector from an angle." - } - ] - } - ] - }, - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 3 - }, - { - "title": "param", - "description": "desired angle, in radians. Unaffected by angleMode().", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "angle" - }, - { - "title": "param", - "description": "length of the new vector (defaults to 1).", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "length" - }, - { - "title": "return", - "description": "new p5.Vector object.", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 2295, - "column": 4, - "index": 65047 - }, - "end": { - "line": 2339, - "column": 5, - "index": 66319 - } - }, - "context": { - "loc": { - "start": { - "line": 2340, - "column": 4, - "index": 66324 - }, - "end": { - "line": 2349, - "column": 5, - "index": 66549 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "angle", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "desired angle, in radians. Unaffected by " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "length", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "length of the new vector (defaults to 1)." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "fromAngle", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "fromAngle", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".fromAngle" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Make a new 3D vector from a pair of ISO spherical angles." - } - ] - } - ] - }, - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 3 - }, - { - "title": "param", - "description": "polar angle in radians (zero is up).", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "theta" - }, - { - "title": "param", - "description": "azimuthal angle in radians\n (zero is out of the screen).", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "phi" - }, - { - "title": "param", - "description": "length of the new vector (defaults to 1).", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "length" - }, - { - "title": "return", - "description": "new p5.Vector object.", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 2351, - "column": 4, - "index": 66555 - }, - "end": { - "line": 2393, - "column": 5, - "index": 67701 - } - }, - "context": { - "loc": { - "start": { - "line": 2394, - "column": 4, - "index": 67706 - }, - "end": { - "line": 2408, - "column": 5, - "index": 68111 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "theta", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "polar angle in radians (zero is up)." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "phi", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "azimuthal angle in radians\n(zero is out of the screen)." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "length", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "length of the new vector (defaults to 1)." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "fromAngles", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "fromAngles", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".fromAngles" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Make a new 2D unit vector with a random heading." - } - ] - } - ] - }, - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 3 - }, - { - "title": "return", - "description": "new p5.Vector object.", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 2410, - "column": 4, - "index": 68117 - }, - "end": { - "line": 2455, - "column": 5, - "index": 69303 - } - }, - "context": { - "loc": { - "start": { - "line": 2456, - "column": 4, - "index": 69308 - }, - "end": { - "line": 2458, - "column": 5, - "index": 69396 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "random2D", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "random2D", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".random2D" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Make a new 3D unit vector with a random heading." - } - ] - } - ] - }, - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 3 - }, - { - "title": "return", - "description": "new p5.Vector object.", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 2460, - "column": 4, - "index": 69402 - }, - "end": { - "line": 2474, - "column": 5, - "index": 69809 - } - }, - "context": { - "loc": { - "start": { - "line": 2475, - "column": 4, - "index": 69814 - }, - "end": { - "line": 2482, - "column": 5, - "index": 70104 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "random3D", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "random3D", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".random3D" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": "the p5.Vector to create a copy of", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v" - }, - { - "title": "return", - "description": "the copy of the p5.Vector object", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "loc": { - "start": { - "line": 2485, - "column": 4, - "index": 70145 - }, - "end": { - "line": 2489, - "column": 5, - "index": 70338 - } - }, - "context": { - "loc": { - "start": { - "line": 2491, - "column": 4, - "index": 70344 - }, - "end": { - "line": 2493, - "column": 5, - "index": 70390 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to create a copy of" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the copy of the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "copy", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "copy", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".copy" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": "A p5.Vector to add", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v1" - }, - { - "title": "param", - "description": "A p5.Vector to add", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v2" - }, - { - "title": "param", - "description": "vector to receive the result.", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - "name": "target" - }, - { - "title": "return", - "description": "resulting p5.Vector.", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "loc": { - "start": { - "line": 2496, - "column": 4, - "index": 70452 - }, - "end": { - "line": 2502, - "column": 5, - "index": 70756 - } - }, - "context": { - "loc": { - "start": { - "line": 2504, - "column": 4, - "index": 70762 - }, - "end": { - "line": 2518, - "column": 5, - "index": 71134 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "target", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "vector to receive the result." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "resulting " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "add", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "add", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".add" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": "The dividend p5.Vector", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v1" - }, - { - "title": "param", - "description": "The divisor p5.Vector", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v2" - } - ], - "loc": { - "start": { - "line": 2521, - "column": 4, - "index": 71211 - }, - "end": { - "line": 2525, - "column": 5, - "index": 71386 - } - }, - "context": { - "loc": { - "start": { - "line": 2532, - "column": 4, - "index": 71549 - }, - "end": { - "line": 2538, - "column": 5, - "index": 71726 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The dividend " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The divisor " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "rem", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "rem", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".rem" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v1" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v2" - }, - { - "title": "return", - "description": "The resulting p5.Vector", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "loc": { - "start": { - "line": 2526, - "column": 4, - "index": 71391 - }, - "end": { - "line": 2531, - "column": 5, - "index": 71544 - } - }, - "context": { - "loc": { - "start": { - "line": 2532, - "column": 4, - "index": 71549 - }, - "end": { - "line": 2538, - "column": 5, - "index": 71726 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The resulting " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "rem", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "rem", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".rem" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": "A p5.Vector to subtract from", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v1" - }, - { - "title": "param", - "description": "A p5.Vector to subtract", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v2" - }, - { - "title": "param", - "description": "vector to receive the result.", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - "name": "target" - }, - { - "title": "return", - "description": "The resulting p5.Vector", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "loc": { - "start": { - "line": 2544, - "column": 4, - "index": 71926 - }, - "end": { - "line": 2550, - "column": 5, - "index": 72248 - } - }, - "context": { - "loc": { - "start": { - "line": 2552, - "column": 4, - "index": 72254 - }, - "end": { - "line": 2566, - "column": 5, - "index": 72626 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to subtract from" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to subtract" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "target", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "vector to receive the result." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The resulting " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "sub", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "sub", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".sub" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Multiplies a vector by a scalar and returns a new vector." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2568, - "column": 4, - "index": 72632 - }, - "end": { - "line": 2570, - "column": 5, - "index": 72704 - } - }, - "context": { - "loc": { - "start": { - "line": 2600, - "column": 4, - "index": 73267 - }, - "end": { - "line": 2614, - "column": 5, - "index": 73637 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2600 - }, - { - "title": "param", - "name": "n", - "lineNumber": 2600 - }, - { - "title": "param", - "name": "target", - "lineNumber": 2600 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mult", - "kind": "function", - "memberof": "p5.Vector", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mult", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".mult" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "z" - }, - { - "title": "return", - "description": "resulting new p5.Vector.", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "loc": { - "start": { - "line": 2572, - "column": 4, - "index": 72710 - }, - "end": { - "line": 2578, - "column": 5, - "index": 72882 - } - }, - "context": { - "loc": { - "start": { - "line": 2600, - "column": 4, - "index": 73267 - }, - "end": { - "line": 2614, - "column": 5, - "index": 73637 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2600 - }, - { - "title": "param", - "name": "n", - "lineNumber": 2600 - }, - { - "title": "param", - "name": "target", - "lineNumber": 2600 - }, - { - "title": "param", - "name": "x", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "resulting new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "mult", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mult", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".mult" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "n" - }, - { - "title": "param", - "description": "vector to receive the result.", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - "name": "target" - } - ], - "loc": { - "start": { - "line": 2580, - "column": 4, - "index": 72888 - }, - "end": { - "line": 2585, - "column": 5, - "index": 73026 - } - }, - "context": { - "loc": { - "start": { - "line": 2600, - "column": 4, - "index": 73267 - }, - "end": { - "line": 2614, - "column": 5, - "index": 73637 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "n", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "target", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "vector to receive the result." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "mult", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mult", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".mult" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v0" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v1" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - "name": "target" - } - ], - "loc": { - "start": { - "line": 2587, - "column": 4, - "index": 73032 - }, - "end": { - "line": 2592, - "column": 5, - "index": 73144 - } - }, - "context": { - "loc": { - "start": { - "line": 2600, - "column": 4, - "index": 73267 - }, - "end": { - "line": 2614, - "column": 5, - "index": 73637 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2600 - }, - { - "title": "param", - "name": "n", - "lineNumber": 2600 - }, - { - "title": "param", - "name": "target", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - }, - { - "title": "param", - "name": "v0", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "v1", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "mult", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mult", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".mult" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v0" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "arr" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - "name": "target" - } - ], - "loc": { - "start": { - "line": 2594, - "column": 4, - "index": 73150 - }, - "end": { - "line": 2599, - "column": 5, - "index": 73262 - } - }, - "context": { - "loc": { - "start": { - "line": 2600, - "column": 4, - "index": 73267 - }, - "end": { - "line": 2614, - "column": 5, - "index": 73637 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2600 - }, - { - "title": "param", - "name": "n", - "lineNumber": 2600 - }, - { - "title": "param", - "name": "target", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - }, - { - "title": "param", - "name": "v0", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "arr", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "mult", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mult", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".mult" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Rotates the vector (only 2D vectors) by the given angle; magnitude remains the same. Returns a new vector." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2616, - "column": 4, - "index": 73643 - }, - "end": { - "line": 2618, - "column": 5, - "index": 73764 - } - }, - "context": { - "loc": { - "start": { - "line": 2626, - "column": 4, - "index": 73919 - }, - "end": { - "line": 2640, - "column": 5, - "index": 74301 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2626 - }, - { - "title": "param", - "name": "a", - "lineNumber": 2626 - }, - { - "title": "param", - "name": "target", - "lineNumber": 2626 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotate", - "kind": "function", - "memberof": "p5.Vector", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "rotate", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".rotate" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "angle" - }, - { - "title": "param", - "description": "The vector to receive the result", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - "name": "target" - } - ], - "loc": { - "start": { - "line": 2620, - "column": 4, - "index": 73770 - }, - "end": { - "line": 2625, - "column": 5, - "index": 73914 - } - }, - "context": { - "loc": { - "start": { - "line": 2626, - "column": 4, - "index": 73919 - }, - "end": { - "line": 2640, - "column": 5, - "index": 74301 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "a", - "lineNumber": 2626 - }, - { - "title": "param", - "name": "target", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The vector to receive the result" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - }, - { - "title": "param", - "name": "angle", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "rotate", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "rotate", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".rotate" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Divides a vector by a scalar and returns a new vector." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2642, - "column": 4, - "index": 74307 - }, - "end": { - "line": 2644, - "column": 5, - "index": 74376 - } - }, - "context": { - "loc": { - "start": { - "line": 2674, - "column": 4, - "index": 74945 - }, - "end": { - "line": 2689, - "column": 5, - "index": 75313 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2674 - }, - { - "title": "param", - "name": "n", - "lineNumber": 2674 - }, - { - "title": "param", - "name": "target", - "lineNumber": 2674 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "div", - "kind": "function", - "memberof": "p5.Vector", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "div", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".div" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "z" - }, - { - "title": "return", - "description": "The resulting new p5.Vector", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "loc": { - "start": { - "line": 2646, - "column": 4, - "index": 74382 - }, - "end": { - "line": 2652, - "column": 5, - "index": 74557 - } - }, - "context": { - "loc": { - "start": { - "line": 2674, - "column": 4, - "index": 74945 - }, - "end": { - "line": 2689, - "column": 5, - "index": 75313 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2674 - }, - { - "title": "param", - "name": "n", - "lineNumber": 2674 - }, - { - "title": "param", - "name": "target", - "lineNumber": 2674 - }, - { - "title": "param", - "name": "x", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The resulting new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "div", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "div", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".div" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "n" - }, - { - "title": "param", - "description": "The vector to receive the result", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - "name": "target" - } - ], - "loc": { - "start": { - "line": 2654, - "column": 4, - "index": 74563 - }, - "end": { - "line": 2659, - "column": 5, - "index": 74704 - } - }, - "context": { - "loc": { - "start": { - "line": 2674, - "column": 4, - "index": 74945 - }, - "end": { - "line": 2689, - "column": 5, - "index": 75313 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "n", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "target", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The vector to receive the result" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "div", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "div", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".div" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v0" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v1" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - "name": "target" - } - ], - "loc": { - "start": { - "line": 2661, - "column": 4, - "index": 74710 - }, - "end": { - "line": 2666, - "column": 5, - "index": 74822 - } - }, - "context": { - "loc": { - "start": { - "line": 2674, - "column": 4, - "index": 74945 - }, - "end": { - "line": 2689, - "column": 5, - "index": 75313 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2674 - }, - { - "title": "param", - "name": "n", - "lineNumber": 2674 - }, - { - "title": "param", - "name": "target", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - }, - { - "title": "param", - "name": "v0", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "v1", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "div", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "div", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".div" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v0" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "arr" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - "name": "target" - } - ], - "loc": { - "start": { - "line": 2668, - "column": 4, - "index": 74828 - }, - "end": { - "line": 2673, - "column": 5, - "index": 74940 - } - }, - "context": { - "loc": { - "start": { - "line": 2674, - "column": 4, - "index": 74945 - }, - "end": { - "line": 2689, - "column": 5, - "index": 75313 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2674 - }, - { - "title": "param", - "name": "n", - "lineNumber": 2674 - }, - { - "title": "param", - "name": "target", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - }, - { - "title": "param", - "name": "v0", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "arr", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "div", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "div", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".div" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates the dot product of two vectors." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2691, - "column": 4, - "index": 75319 - }, - "end": { - "line": 2693, - "column": 5, - "index": 75376 - } - }, - "context": { - "loc": { - "start": { - "line": 2700, - "column": 4, - "index": 75590 - }, - "end": { - "line": 2702, - "column": 5, - "index": 75641 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2700 - }, - { - "title": "param", - "name": "v2", - "lineNumber": 2700 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dot", - "kind": "function", - "memberof": "p5.Vector", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "dot", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".dot" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": "first p5.Vector.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v1" - }, - { - "title": "param", - "description": "second p5.Vector.", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v2" - }, - { - "title": "return", - "description": "dot product.", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "loc": { - "start": { - "line": 2694, - "column": 4, - "index": 75381 - }, - "end": { - "line": 2699, - "column": 5, - "index": 75585 - } - }, - "context": { - "loc": { - "start": { - "line": 2700, - "column": 4, - "index": 75590 - }, - "end": { - "line": 2702, - "column": 5, - "index": 75641 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "first " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "second " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "dot product." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "dot", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "dot", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".dot" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates the cross product of two vectors." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2704, - "column": 4, - "index": 75647 - }, - "end": { - "line": 2706, - "column": 5, - "index": 75706 - } - }, - "context": { - "loc": { - "start": { - "line": 2713, - "column": 4, - "index": 75922 - }, - "end": { - "line": 2715, - "column": 5, - "index": 75977 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2713 - }, - { - "title": "param", - "name": "v2", - "lineNumber": 2713 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "cross", - "kind": "function", - "memberof": "p5.Vector", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "cross", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".cross" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": "first p5.Vector.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v1" - }, - { - "title": "param", - "description": "second p5.Vector.", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v2" - }, - { - "title": "return", - "description": "cross product.", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "loc": { - "start": { - "line": 2707, - "column": 4, - "index": 75711 - }, - "end": { - "line": 2712, - "column": 5, - "index": 75917 - } - }, - "context": { - "loc": { - "start": { - "line": 2713, - "column": 4, - "index": 75922 - }, - "end": { - "line": 2715, - "column": 5, - "index": 75977 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "first " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "second " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "cross product." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "cross", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "cross", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".cross" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates the Euclidean distance between two points (considering a\npoint as a vector object)." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2717, - "column": 4, - "index": 75983 - }, - "end": { - "line": 2720, - "column": 5, - "index": 76097 - } - }, - "context": { - "loc": { - "start": { - "line": 2727, - "column": 4, - "index": 76317 - }, - "end": { - "line": 2729, - "column": 5, - "index": 76370 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2727 - }, - { - "title": "param", - "name": "v2", - "lineNumber": 2727 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dist", - "kind": "function", - "memberof": "p5.Vector", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "dist", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".dist" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": "The first p5.Vector", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v1" - }, - { - "title": "param", - "description": "The second p5.Vector", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v2" - }, - { - "title": "return", - "description": "The distance", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "loc": { - "start": { - "line": 2721, - "column": 4, - "index": 76102 - }, - "end": { - "line": 2726, - "column": 5, - "index": 76312 - } - }, - "context": { - "loc": { - "start": { - "line": 2727, - "column": 4, - "index": 76317 - }, - "end": { - "line": 2729, - "column": 5, - "index": 76370 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The distance" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "dist", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "dist", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".dist" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Linear interpolate a vector to another vector and return the result as a\nnew vector." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2731, - "column": 4, - "index": 76376 - }, - "end": { - "line": 2734, - "column": 5, - "index": 76480 - } - }, - "context": { - "loc": { - "start": { - "line": 2743, - "column": 4, - "index": 76704 - }, - "end": { - "line": 2757, - "column": 5, - "index": 77089 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2743 - }, - { - "title": "param", - "name": "v2", - "lineNumber": 2743 - }, - { - "title": "param", - "name": "amt", - "lineNumber": 2743 - }, - { - "title": "param", - "name": "target", - "lineNumber": 2743 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "lerp", - "kind": "function", - "memberof": "p5.Vector", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "lerp", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".lerp" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v1" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v2" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "amt" - }, - { - "title": "param", - "description": "The vector to receive the result", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - "name": "target" - }, - { - "title": "return", - "description": "The lerped value", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "loc": { - "start": { - "line": 2735, - "column": 4, - "index": 76485 - }, - "end": { - "line": 2742, - "column": 5, - "index": 76699 - } - }, - "context": { - "loc": { - "start": { - "line": 2743, - "column": 4, - "index": 76704 - }, - "end": { - "line": 2757, - "column": 5, - "index": 77089 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "amt", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "target", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The vector to receive the result" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The lerped value" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "lerp", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "lerp", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".lerp" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Performs spherical linear interpolation with the other vector\nand returns the resulting vector.\nThis works in both 3D and 2D. As for 2D, the result of slerping\nbetween 2D vectors is always a 2D vector." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2759, - "column": 4, - "index": 77095 - }, - "end": { - "line": 2764, - "column": 5, - "index": 77326 - } - }, - "context": { - "loc": { - "start": { - "line": 2773, - "column": 4, - "index": 77582 - }, - "end": { - "line": 2787, - "column": 5, - "index": 77970 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2773 - }, - { - "title": "param", - "name": "v2", - "lineNumber": 2773 - }, - { - "title": "param", - "name": "amt", - "lineNumber": 2773 - }, - { - "title": "param", - "name": "target", - "lineNumber": 2773 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "slerp", - "kind": "function", - "memberof": "p5.Vector", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "slerp", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".slerp" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": "old vector.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v1" - }, - { - "title": "param", - "description": "new vector.", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v2" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "amt" - }, - { - "title": "param", - "description": "vector to receive the result.", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - "name": "target" - }, - { - "title": "return", - "description": "slerped vector between v1 and v2", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "loc": { - "start": { - "line": 2765, - "column": 4, - "index": 77331 - }, - "end": { - "line": 2772, - "column": 5, - "index": 77577 - } - }, - "context": { - "loc": { - "start": { - "line": 2773, - "column": 4, - "index": 77582 - }, - "end": { - "line": 2787, - "column": 5, - "index": 77970 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "old vector." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new vector." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "amt", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "target", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "vector to receive the result." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "slerped vector between v1 and v2" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "slerp", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "slerp", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".slerp" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates the magnitude (length) of the vector and returns the result as\na float (this is simply the equation " - }, - { - "type": "inlineCode", - "value": "sqrt(x*x + y*y + z*z)" - }, - { - "type": "text", - "value": ".)" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2789, - "column": 4, - "index": 77976 - }, - "end": { - "line": 2792, - "column": 5, - "index": 78132 - } - }, - "context": { - "loc": { - "start": { - "line": 2798, - "column": 4, - "index": 78282 - }, - "end": { - "line": 2800, - "column": 5, - "index": 78331 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "vecT", - "lineNumber": 2798 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mag", - "kind": "function", - "memberof": "p5.Vector", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mag", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".mag" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": "The vector to return the magnitude of", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "vecT" - }, - { - "title": "return", - "description": "The magnitude of vecT", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "loc": { - "start": { - "line": 2793, - "column": 4, - "index": 78137 - }, - "end": { - "line": 2797, - "column": 5, - "index": 78277 - } - }, - "context": { - "loc": { - "start": { - "line": 2798, - "column": 4, - "index": 78282 - }, - "end": { - "line": 2800, - "column": 5, - "index": 78331 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "vecT", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The vector to return the magnitude of" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The magnitude of vecT" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "mag", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mag", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".mag" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates the squared magnitude of the vector and returns the result\nas a float (this is simply the equation " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "(x*x + y*y + z*z)" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".)\nFaster if the real length is not required in the\ncase of comparing vectors, etc." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2802, - "column": 4, - "index": 78337 - }, - "end": { - "line": 2807, - "column": 5, - "index": 78589 - } - }, - "context": { - "loc": { - "start": { - "line": 2813, - "column": 4, - "index": 78755 - }, - "end": { - "line": 2815, - "column": 5, - "index": 78808 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "vecT", - "lineNumber": 2813 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "magSq", - "kind": "function", - "memberof": "p5.Vector", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "magSq", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".magSq" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": "the vector to return the squared magnitude of", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "vecT" - }, - { - "title": "return", - "description": "the squared magnitude of vecT", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "loc": { - "start": { - "line": 2808, - "column": 4, - "index": 78594 - }, - "end": { - "line": 2812, - "column": 5, - "index": 78750 - } - }, - "context": { - "loc": { - "start": { - "line": 2813, - "column": 4, - "index": 78755 - }, - "end": { - "line": 2815, - "column": 5, - "index": 78808 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "vecT", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the vector to return the squared magnitude of" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the squared magnitude of vecT" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "magSq", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "magSq", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".magSq" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Normalize the vector to length 1 (make it a unit vector)." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2817, - "column": 4, - "index": 78814 - }, - "end": { - "line": 2819, - "column": 5, - "index": 78886 - } - }, - "context": { - "loc": { - "start": { - "line": 2826, - "column": 4, - "index": 79104 - }, - "end": { - "line": 2839, - "column": 5, - "index": 79475 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2826 - }, - { - "title": "param", - "name": "target", - "lineNumber": 2826 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "normalize", - "kind": "function", - "memberof": "p5.Vector", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "normalize", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".normalize" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": "The vector to normalize", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v" - }, - { - "title": "param", - "description": "The vector to receive the result", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - "name": "target" - }, - { - "title": "return", - "description": "The vector v, normalized to a length of 1", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "loc": { - "start": { - "line": 2820, - "column": 4, - "index": 78891 - }, - "end": { - "line": 2825, - "column": 5, - "index": 79099 - } - }, - "context": { - "loc": { - "start": { - "line": 2826, - "column": 4, - "index": 79104 - }, - "end": { - "line": 2839, - "column": 5, - "index": 79475 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The vector to normalize" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "target", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The vector to receive the result" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The vector v, normalized to a length of 1" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "normalize", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "normalize", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".normalize" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Limit the magnitude of the vector to the value used for the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "max" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nparameter." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2841, - "column": 4, - "index": 79481 - }, - "end": { - "line": 2844, - "column": 5, - "index": 79582 - } - }, - "context": { - "loc": { - "start": { - "line": 2852, - "column": 4, - "index": 79825 - }, - "end": { - "line": 2865, - "column": 5, - "index": 80192 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2852 - }, - { - "title": "param", - "name": "max", - "lineNumber": 2852 - }, - { - "title": "param", - "name": "target", - "lineNumber": 2852 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "limit", - "kind": "function", - "memberof": "p5.Vector", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "limit", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".limit" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": "the vector to limit", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "max" - }, - { - "title": "param", - "description": "the vector to receive the result (Optional)", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - "name": "target" - }, - { - "title": "return", - "description": "v with a magnitude limited to max", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "loc": { - "start": { - "line": 2845, - "column": 4, - "index": 79587 - }, - "end": { - "line": 2851, - "column": 5, - "index": 79820 - } - }, - "context": { - "loc": { - "start": { - "line": 2852, - "column": 4, - "index": 79825 - }, - "end": { - "line": 2865, - "column": 5, - "index": 80192 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the vector to limit" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "max", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "target", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the vector to receive the result (Optional)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "v with a magnitude limited to max" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "limit", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "limit", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".limit" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Set the magnitude of the vector to the value used for the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "len" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nparameter." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2867, - "column": 4, - "index": 80198 - }, - "end": { - "line": 2870, - "column": 5, - "index": 80297 - } - }, - "context": { - "loc": { - "start": { - "line": 2878, - "column": 4, - "index": 80551 - }, - "end": { - "line": 2891, - "column": 5, - "index": 80921 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2878 - }, - { - "title": "param", - "name": "len", - "lineNumber": 2878 - }, - { - "title": "param", - "name": "target", - "lineNumber": 2878 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setMag", - "kind": "function", - "memberof": "p5.Vector", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setMag", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".setMag" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": "the vector to set the magnitude of", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "number" - }, - "name": "len" - }, - { - "title": "param", - "description": "the vector to receive the result (Optional)", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - "name": "target" - }, - { - "title": "return", - "description": "v with a magnitude set to len", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "loc": { - "start": { - "line": 2871, - "column": 4, - "index": 80302 - }, - "end": { - "line": 2877, - "column": 5, - "index": 80546 - } - }, - "context": { - "loc": { - "start": { - "line": 2878, - "column": 4, - "index": 80551 - }, - "end": { - "line": 2891, - "column": 5, - "index": 80921 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the vector to set the magnitude of" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "len", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "number" - } - }, - { - "title": "param", - "name": "target", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the vector to receive the result (Optional)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "v with a magnitude set to len" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "setMag", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setMag", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".setMag" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculate the angle of rotation for this vector (only 2D vectors).\np5.Vectors created using " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createVector()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nwill take the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " into\nconsideration, and give the angle in radians or degrees accordingly." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2893, - "column": 4, - "index": 80927 - }, - "end": { - "line": 2898, - "column": 5, - "index": 81230 - } - }, - "context": { - "loc": { - "start": { - "line": 2904, - "column": 4, - "index": 81364 - }, - "end": { - "line": 2906, - "column": 5, - "index": 81415 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2904 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "heading", - "kind": "function", - "memberof": "p5.Vector", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "heading", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".heading" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": "the vector to find the angle of", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v" - }, - { - "title": "return", - "description": "the angle of rotation", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "loc": { - "start": { - "line": 2899, - "column": 4, - "index": 81235 - }, - "end": { - "line": 2903, - "column": 5, - "index": 81359 - } - }, - "context": { - "loc": { - "start": { - "line": 2904, - "column": 4, - "index": 81364 - }, - "end": { - "line": 2906, - "column": 5, - "index": 81415 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the vector to find the angle of" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the angle of rotation" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "heading", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "heading", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".heading" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates and returns the angle between two vectors. This function will take\nthe " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " on v1 into consideration, and\ngive the angle in radians or degrees accordingly." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2908, - "column": 4, - "index": 81421 - }, - "end": { - "line": 2912, - "column": 5, - "index": 81646 - } - }, - "context": { - "loc": { - "start": { - "line": 2919, - "column": 4, - "index": 81836 - }, - "end": { - "line": 2921, - "column": 5, - "index": 81905 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2919 - }, - { - "title": "param", - "name": "v2", - "lineNumber": 2919 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "angleBetween", - "kind": "function", - "memberof": "p5.Vector", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "angleBetween", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".angleBetween" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": "the first vector.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v1" - }, - { - "title": "param", - "description": "the second vector.", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v2" - }, - { - "title": "return", - "description": "angle between the two vectors.", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "loc": { - "start": { - "line": 2913, - "column": 4, - "index": 81651 - }, - "end": { - "line": 2918, - "column": 5, - "index": 81831 - } - }, - "context": { - "loc": { - "start": { - "line": 2919, - "column": 4, - "index": 81836 - }, - "end": { - "line": 2921, - "column": 5, - "index": 81905 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the first vector." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the second vector." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "angle between the two vectors." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "angleBetween", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "angleBetween", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".angleBetween" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reflect a vector about a normal to a line in 2D, or about a normal to a\nplane in 3D." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2923, - "column": 4, - "index": 81911 - }, - "end": { - "line": 2926, - "column": 5, - "index": 82015 - } - }, - "context": { - "loc": { - "start": { - "line": 2934, - "column": 4, - "index": 82260 - }, - "end": { - "line": 2947, - "column": 5, - "index": 82692 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "incidentVector", - "lineNumber": 2934 - }, - { - "title": "param", - "name": "surfaceNormal", - "lineNumber": 2934 - }, - { - "title": "param", - "name": "target", - "lineNumber": 2934 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "reflect", - "kind": "function", - "memberof": "p5.Vector", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "reflect", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".reflect" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": "vector to be reflected.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "incidentVector" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "surfaceNormal" - }, - { - "title": "param", - "description": "vector to receive the result.", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - "name": "target" - }, - { - "title": "return", - "description": "the reflected vector", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "loc": { - "start": { - "line": 2927, - "column": 4, - "index": 82020 - }, - "end": { - "line": 2933, - "column": 5, - "index": 82255 - } - }, - "context": { - "loc": { - "start": { - "line": 2934, - "column": 4, - "index": 82260 - }, - "end": { - "line": 2947, - "column": 5, - "index": 82692 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "incidentVector", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "vector to be reflected." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "surfaceNormal", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "target", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "vector to receive the result." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the reflected vector" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "reflect", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "reflect", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".reflect" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Return a representation of this vector as a float array. This is only\nfor temporary use. If used in any other fashion, the contents should be\ncopied by using the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector." - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "copy()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nmethod to copy into your own vector." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2949, - "column": 4, - "index": 82698 - }, - "end": { - "line": 2954, - "column": 5, - "index": 82981 - } - }, - "context": { - "loc": { - "start": { - "line": 2960, - "column": 4, - "index": 83125 - }, - "end": { - "line": 2962, - "column": 5, - "index": 83172 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2960 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "array", - "kind": "function", - "memberof": "p5.Vector", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "array", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".array" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": "the vector to convert to an array", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "v" - }, - { - "title": "return", - "description": "an Array with the 3 values", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "loc": { - "start": { - "line": 2955, - "column": 4, - "index": 82986 - }, - "end": { - "line": 2959, - "column": 5, - "index": 83120 - } - }, - "context": { - "loc": { - "start": { - "line": 2960, - "column": 4, - "index": 83125 - }, - "end": { - "line": 2962, - "column": 5, - "index": 83172 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the vector to convert to an array" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "an Array with the 3 values" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "array", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "array", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".array" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Equality check against a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2964, - "column": 4, - "index": 83178 - }, - "end": { - "line": 2966, - "column": 5, - "index": 83253 - } - }, - "context": { - "loc": { - "start": { - "line": 2973, - "column": 4, - "index": 83431 - }, - "end": { - "line": 2986, - "column": 5, - "index": 83787 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2973 - }, - { - "title": "param", - "name": "v2", - "lineNumber": 2973 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "equals", - "kind": "function", - "memberof": "p5.Vector", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "equals", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".equals" - }, - { - "description": "", - "tags": [ - { - "title": "static", - "description": null, - "lineNumber": 1 - }, - { - "title": "param", - "description": "the first vector to compare", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "NameExpression", - "name": "Array" - } - ] - }, - "name": "v1" - }, - { - "title": "param", - "description": "the second vector to compare", - "lineNumber": 3, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "NameExpression", - "name": "Array" - } - ] - }, - "name": "v2" - }, - { - "title": "return", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "loc": { - "start": { - "line": 2967, - "column": 4, - "index": 83258 - }, - "end": { - "line": 2972, - "column": 5, - "index": 83426 - } - }, - "context": { - "loc": { - "start": { - "line": 2973, - "column": 4, - "index": 83431 - }, - "end": { - "line": 2986, - "column": 5, - "index": 83787 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the first vector to compare" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "NameExpression", - "name": "Array" - } - ] - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the second vector to compare" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "NameExpression", - "name": "Array" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "scope": "static", - "name": "equals", - "kind": "function", - "memberof": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "equals", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".equals" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the bounding box for a string of text written using this\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Font" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "str" - }, - { - "type": "text", - "value": ", is a string of text. The second and third\nparameters, " - }, - { - "type": "inlineCode", - "value": "x" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "y" - }, - { - "type": "text", - "value": ", are the text's position. By default, they set the\ncoordinates of the bounding box's bottom-left corner. See\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "textAlign()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for more ways to align text." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The fourth parameter, " - }, - { - "type": "inlineCode", - "value": "fontSize" - }, - { - "type": "text", - "value": ", is optional. It sets the font size used to\ndetermine the bounding box. By default, " - }, - { - "type": "inlineCode", - "value": "font.textBounds()" - }, - { - "type": "text", - "value": " will use the\ncurrent " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "textSize()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "string of text.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "str" - }, - { - "title": "param", - "description": "x-coordinate of the text.", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y-coordinate of the text.", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "font size. Defaults to the current\n textSize().", - "lineNumber": 16, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "fontSize" - }, - { - "title": "return", - "description": "object describing the bounding box with\n properties x, y, w, and h.", - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 21 - } - ], - "loc": { - "start": { - "line": 47, - "column": 2, - "index": 908 - }, - "end": { - "line": 138, - "column": 3, - "index": 3287 - } - }, - "context": { - "loc": { - "start": { - "line": 139, - "column": 2, - "index": 3290 - }, - "end": { - "line": 238, - "column": 3, - "index": 6150 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/p5.Font.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "str", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "string of text." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "x", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the text." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "default": "0" - }, - { - "title": "param", - "name": "y", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the text." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "default": "0" - }, - { - "title": "param", - "name": "fontSize", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "font size. Defaults to the current\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "textSize()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "opts", - "lineNumber": 139 - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "object describing the bounding box with\nproperties x, y, w, and h." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "textBounds", - "kind": "function", - "memberof": "p5.Font", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "textBounds", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#textBounds" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns an array of points outlining a string of text written using this\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Font" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "str" - }, - { - "type": "text", - "value": ", is a string of text. The second and third\nparameters, " - }, - { - "type": "inlineCode", - "value": "x" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "y" - }, - { - "type": "text", - "value": ", are the text's position. By default, they set the\ncoordinates of the bounding box's bottom-left corner. See\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "textAlign()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for more ways to align text." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The fourth parameter, " - }, - { - "type": "inlineCode", - "value": "fontSize" - }, - { - "type": "text", - "value": ", is optional. It sets the text's font\nsize. By default, " - }, - { - "type": "inlineCode", - "value": "font.textToPoints()" - }, - { - "type": "text", - "value": " will use the current\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "textSize()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The fifth parameter, " - }, - { - "type": "inlineCode", - "value": "options" - }, - { - "type": "text", - "value": ", is also optional. " - }, - { - "type": "inlineCode", - "value": "font.textToPoints()" - }, - { - "type": "text", - "value": "\nexpects an object with the following properties:" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "sampleFactor" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "simplifyThreshold" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "string of text.", - "lineNumber": 24, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "str" - }, - { - "title": "param", - "description": "x-coordinate of the text.", - "lineNumber": 25, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y-coordinate of the text.", - "lineNumber": 26, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "font size. Defaults to the current\n textSize().", - "lineNumber": 27, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "fontSize" - }, - { - "title": "param", - "description": "object with sampleFactor and simplifyThreshold\n properties.", - "lineNumber": 29, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - }, - "name": "options" - }, - { - "title": "return", - "description": "array of point objects, each with x, y, and alpha (path angle) properties.", - "lineNumber": 31, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 32 - } - ], - "loc": { - "start": { - "line": 240, - "column": 2, - "index": 6154 - }, - "end": { - "line": 292, - "column": 3, - "index": 8196 - } - }, - "context": { - "loc": { - "start": { - "line": 293, - "column": 2, - "index": 8199 - }, - "end": { - "line": 340, - "column": 3, - "index": 9504 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/p5.Font.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "txt", - "lineNumber": 293 - }, - { - "title": "param", - "name": "x", - "lineNumber": 25, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the text." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 26, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the text." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "fontSize", - "lineNumber": 27, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "font size. Defaults to the current\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "textSize()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "options", - "lineNumber": 29, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "object with sampleFactor and simplifyThreshold\nproperties." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - } - }, - { - "title": "param", - "name": "str", - "lineNumber": 24, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "string of text." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "array of point objects, each with x, y, and alpha (path angle) properties." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "textToPoints", - "kind": "function", - "memberof": "p5.Font", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "textToPoints", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#textToPoints" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "End shape drawing and render vertices to screen." - } - ] - } - ] - }, - "tags": [ - { - "title": "chainable", - "description": null, - "lineNumber": 2 - } - ], - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 6069 - }, - "end": { - "line": 194, - "column": 3, - "index": 6142 - } - }, - "context": { - "loc": { - "start": { - "line": 195, - "column": 0, - "index": 6143 - }, - "end": { - "line": 270, - "column": 2, - "index": 8430 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.Immediate.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "mode", - "lineNumber": 196 - }, - { - "title": "param", - "name": "isCurve", - "lineNumber": 197 - }, - { - "title": "param", - "name": "isBezier", - "lineNumber": 198 - }, - { - "title": "param", - "name": "isQuadratic", - "lineNumber": 199 - }, - { - "title": "param", - "name": "isContour", - "lineNumber": 200 - }, - { - "title": "param", - "name": "shapeKind", - "lineNumber": 201 - }, - { - "title": "param", - "name": "count", - "lineNumber": 202, - "default": "1" - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "endShape", - "kind": "function", - "memberof": "p5.RendererGL", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "endShape", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#endShape" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Starts creating a new p5.Geometry. Subsequent shapes drawn will be added\nto the geometry and then returned when\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endGeometry()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is called. One can also use\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "buildGeometry()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to pass a function that\ndraws shapes." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If you need to draw complex shapes every frame which don't change over time,\ncombining them upfront with " - }, - { - "type": "inlineCode", - "value": "beginGeometry()" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "endGeometry()" - }, - { - "type": "text", - "value": " and then\ndrawing that will run faster than repeatedly drawing the individual pieces." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 672, - "column": 2, - "index": 22029 - }, - "end": { - "line": 682, - "column": 5, - "index": 22600 - } - }, - "context": { - "loc": { - "start": { - "line": 683, - "column": 2, - "index": 22603 - }, - "end": { - "line": 688, - "column": 3, - "index": 22840 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "beginGeometry", - "kind": "function", - "memberof": "p5.RendererGL", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "beginGeometry", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#beginGeometry" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Finishes creating a new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Geometry" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " that was\nstarted using " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginGeometry()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". One can also\nuse " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "buildGeometry()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to pass a function that\ndraws shapes." - } - ] - } - ] - }, - "tags": [ - { - "title": "returns", - "description": "The model that was built.", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - } - } - ], - "loc": { - "start": { - "line": 690, - "column": 2, - "index": 22844 - }, - "end": { - "line": 697, - "column": 5, - "index": 23173 - } - }, - "context": { - "loc": { - "start": { - "line": 698, - "column": 2, - "index": 23176 - }, - "end": { - "line": 705, - "column": 3, - "index": 23428 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The model that was built." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "endGeometry", - "kind": "function", - "memberof": "p5.RendererGL", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "endGeometry", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#endGeometry" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Geometry" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " that contains all\nthe shapes drawn in a provided callback function. The returned combined shape\ncan then be drawn all at once using " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "model()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If you need to draw complex shapes every frame which don't change over time,\ncombining them with " - }, - { - "type": "inlineCode", - "value": "buildGeometry()" - }, - { - "type": "text", - "value": " once and then drawing that will run\nfaster than repeatedly drawing the individual pieces." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "One can also draw shapes directly between\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginGeometry()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endGeometry()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " instead of using a callback\nfunction." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "A function that draws shapes.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Function" - }, - "name": "callback" - }, - { - "title": "returns", - "description": "The model that was built from the callback function.", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - } - } - ], - "loc": { - "start": { - "line": 707, - "column": 2, - "index": 23432 - }, - "end": { - "line": 722, - "column": 5, - "index": 24247 - } - }, - "context": { - "loc": { - "start": { - "line": 723, - "column": 2, - "index": 24250 - }, - "end": { - "line": 727, - "column": 3, - "index": 24352 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "callback", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A function that draws shapes." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Function" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The model that was built from the callback function." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "buildGeometry", - "kind": "function", - "memberof": "p5.RendererGL", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "buildGeometry", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#buildGeometry" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "[background description]" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 882, - "column": 2, - "index": 29343 - }, - "end": { - "line": 884, - "column": 3, - "index": 29378 - } - }, - "context": { - "loc": { - "start": { - "line": 885, - "column": 2, - "index": 29381 - }, - "end": { - "line": 892, - "column": 3, - "index": 29631 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "args", - "lineNumber": 885, - "type": { - "type": "RestType" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "background", - "kind": "function", - "memberof": "p5.RendererGL", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "background", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#background" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Basic fill material for geometry with a given color" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "gray value,\nred or hue value (depending on the current color mode),\nor color Array, or CSS color string", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "p5.Color" - } - ] - }, - "name": "v1" - }, - { - "title": "param", - "description": "green or saturation value", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "v2" - }, - { - "title": "param", - "description": "blue or brightness value", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "v3" - }, - { - "title": "param", - "description": "opacity", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "a" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\n\nfunction setup() {\n createCanvas(200, 200, WEBGL);\n}\n\nfunction draw() {\n background(0);\n noStroke();\n fill(100, 100, 240);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n box(75, 75, 75);\n}\n\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "black canvas with purple cube spinning", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 897, - "column": 2, - "index": 29744 - }, - "end": { - "line": 926, - "column": 3, - "index": 30494 - } - }, - "context": { - "loc": { - "start": { - "line": 927, - "column": 2, - "index": 30497 - }, - "end": { - "line": 934, - "column": 3, - "index": 30786 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nfunction setup() {\n createCanvas(200, 200, WEBGL);\n}\n\nfunction draw() {\n background(0);\n noStroke();\n fill(100, 100, 240);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n box(75, 75, 75);\n}\n\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "gray value,\nred or hue value (depending on the current color mode),\nor color Array, or CSS color string" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "p5.Color" - } - ] - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "green or saturation value" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "v3", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "blue or brightness value" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "a", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "opacity" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "fill", - "kind": "function", - "memberof": "p5.RendererGL", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "fill", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#fill" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Basic stroke material for geometry with a given color" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "gray value,\nred or hue value (depending on the current color mode),\nor color Array, or CSS color string", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "p5.Color" - } - ] - }, - "name": "v1" - }, - { - "title": "param", - "description": "green or saturation value", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "v2" - }, - { - "title": "param", - "description": "blue or brightness value", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "v3" - }, - { - "title": "param", - "description": "opacity", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "a" - }, - { - "title": "example", - "description": "
\n\nfunction setup() {\n createCanvas(200, 200, WEBGL);\n}\n\nfunction draw() {\n background(0);\n stroke(240, 150, 150);\n fill(100, 100, 240);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n box(75, 75, 75);\n}\n\n
", - "lineNumber": 8 - }, - { - "title": "alt", - "description": "black canvas with purple cube with pink outline spinning", - "lineNumber": 26 - } - ], - "loc": { - "start": { - "line": 936, - "column": 2, - "index": 30790 - }, - "end": { - "line": 964, - "column": 3, - "index": 31557 - } - }, - "context": { - "loc": { - "start": { - "line": 965, - "column": 2, - "index": 31560 - }, - "end": { - "line": 968, - "column": 3, - "index": 31692 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nfunction setup() {\n createCanvas(200, 200, WEBGL);\n}\n\nfunction draw() {\n background(0);\n stroke(240, 150, 150);\n fill(100, 100, 240);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n box(75, 75, 75);\n}\n\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "r", - "lineNumber": 965 - }, - { - "title": "param", - "name": "g", - "lineNumber": 965 - }, - { - "title": "param", - "name": "b", - "lineNumber": 965 - }, - { - "title": "param", - "name": "a", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "opacity" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "v1", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "gray value,\nred or hue value (depending on the current color mode),\nor color Array, or CSS color string" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "p5.Color" - } - ] - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "green or saturation value" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "v3", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "blue or brightness value" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "stroke", - "kind": "function", - "memberof": "p5.RendererGL", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "stroke", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#stroke" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Change weight of stroke" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "weight to be used for drawing", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "stroke" - }, - { - "title": "example", - "description": "
\n\nfunction setup() {\n createCanvas(200, 400, WEBGL);\n setAttributes('antialias', true);\n}\n\nfunction draw() {\n background(0);\n noStroke();\n translate(0, -100, 0);\n stroke(240, 150, 150);\n fill(100, 100, 240);\n push();\n strokeWeight(8);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n sphere(75);\n pop();\n push();\n translate(0, 200, 0);\n strokeWeight(1);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n sphere(75);\n pop();\n}\n\n
", - "lineNumber": 3 - }, - { - "title": "alt", - "description": "black canvas with two purple rotating spheres with pink\noutlines the sphere on top has much heavier outlines,", - "lineNumber": 34 - } - ], - "loc": { - "start": { - "line": 1249, - "column": 2, - "index": 40277 - }, - "end": { - "line": 1286, - "column": 3, - "index": 41084 - } - }, - "context": { - "loc": { - "start": { - "line": 1287, - "column": 2, - "index": 41087 - }, - "end": { - "line": 1292, - "column": 3, - "index": 41210 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nfunction setup() {\n createCanvas(200, 400, WEBGL);\n setAttributes('antialias', true);\n}\n\nfunction draw() {\n background(0);\n noStroke();\n translate(0, -100, 0);\n stroke(240, 150, 150);\n fill(100, 100, 240);\n push();\n strokeWeight(8);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n sphere(75);\n pop();\n push();\n translate(0, 200, 0);\n strokeWeight(1);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n sphere(75);\n pop();\n}\n\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "w", - "lineNumber": 1287 - }, - { - "title": "param", - "name": "stroke", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "weight to be used for drawing" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "strokeWeight", - "kind": "function", - "memberof": "p5.RendererGL", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "strokeWeight", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#strokeWeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Resets all depth information so that nothing previously drawn will\nocclude anything subsequently drawn." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 1466, - "column": 2, - "index": 45650 - }, - "end": { - "line": 1469, - "column": 5, - "index": 45773 - } - }, - "context": { - "loc": { - "start": { - "line": 1470, - "column": 2, - "index": 45776 - }, - "end": { - "line": 1473, - "column": 3, - "index": 45879 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "depth", - "lineNumber": 1470, - "default": "1" - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clearDepth", - "kind": "function", - "memberof": "p5.RendererGL", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "clearDepth", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#clearDepth" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": "The model whose resources will be freed", - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - }, - "name": "geometry" - } - ], - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 208 - }, - "end": { - "line": 10, - "column": 3, - "index": 288 - } - }, - "context": { - "loc": { - "start": { - "line": 11, - "column": 0, - "index": 289 - }, - "end": { - "line": 17, - "column": 2, - "index": 504 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.Retained.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "geometry", - "lineNumber": 1, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The model whose resources will be freed" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "freeGeometry", - "kind": "function", - "memberof": "p5.RendererGL", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "freeGeometry", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#freeGeometry" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "camera position value on x axis. default value is 0" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "eyeX" - }, - { - "title": "readonly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - }, - { - "title": "alt", - "description": "An example showing the use of camera object properties", - "lineNumber": 24 - } - ], - "loc": { - "start": { - "line": 495, - "column": 2, - "index": 16589 - }, - "end": { - "line": 522, - "column": 3, - "index": 17177 - } - }, - "context": { - "loc": { - "start": { - "line": 788, - "column": 2, - "index": 23195 - }, - "end": { - "line": 843, - "column": 3, - "index": 24944 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fovy", - "lineNumber": 788 - }, - { - "title": "param", - "name": "aspect", - "lineNumber": 788 - }, - { - "title": "param", - "name": "near", - "lineNumber": 788 - }, - { - "title": "param", - "name": "far", - "lineNumber": 788 - } - ], - "properties": [ - { - "title": "property", - "name": "eyeX", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "readonly": true, - "name": "perspective", - "kind": "function", - "memberof": "p5.Camera", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "perspective", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#perspective" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "camera position value on y axis. default value is 0" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "eyeY" - }, - { - "title": "readonly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - }, - { - "title": "alt", - "description": "An example showing the use of camera object properties", - "lineNumber": 23 - } - ], - "loc": { - "start": { - "line": 524, - "column": 2, - "index": 17181 - }, - "end": { - "line": 550, - "column": 3, - "index": 17766 - } - }, - "context": { - "loc": { - "start": { - "line": 788, - "column": 2, - "index": 23195 - }, - "end": { - "line": 843, - "column": 3, - "index": 24944 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fovy", - "lineNumber": 788 - }, - { - "title": "param", - "name": "aspect", - "lineNumber": 788 - }, - { - "title": "param", - "name": "near", - "lineNumber": 788 - }, - { - "title": "param", - "name": "far", - "lineNumber": 788 - } - ], - "properties": [ - { - "title": "property", - "name": "eyeY", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "readonly": true, - "name": "perspective", - "kind": "function", - "memberof": "p5.Camera", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "perspective", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#perspective" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "camera position value on z axis. default value is 800" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "eyeZ" - }, - { - "title": "readonly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - }, - { - "title": "alt", - "description": "An example showing the use of camera object properties", - "lineNumber": 23 - } - ], - "loc": { - "start": { - "line": 552, - "column": 2, - "index": 17770 - }, - "end": { - "line": 578, - "column": 3, - "index": 18357 - } - }, - "context": { - "loc": { - "start": { - "line": 788, - "column": 2, - "index": 23195 - }, - "end": { - "line": 843, - "column": 3, - "index": 24944 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fovy", - "lineNumber": 788 - }, - { - "title": "param", - "name": "aspect", - "lineNumber": 788 - }, - { - "title": "param", - "name": "near", - "lineNumber": 788 - }, - { - "title": "param", - "name": "far", - "lineNumber": 788 - } - ], - "properties": [ - { - "title": "property", - "name": "eyeZ", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "readonly": true, - "name": "perspective", - "kind": "function", - "memberof": "p5.Camera", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "perspective", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#perspective" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x coordinate representing center of the sketch" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "centerX" - }, - { - "title": "readonly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - }, - { - "title": "alt", - "description": "An example showing the use of camera object properties", - "lineNumber": 24 - } - ], - "loc": { - "start": { - "line": 580, - "column": 2, - "index": 18361 - }, - "end": { - "line": 607, - "column": 3, - "index": 18995 - } - }, - "context": { - "loc": { - "start": { - "line": 788, - "column": 2, - "index": 23195 - }, - "end": { - "line": 843, - "column": 3, - "index": 24944 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fovy", - "lineNumber": 788 - }, - { - "title": "param", - "name": "aspect", - "lineNumber": 788 - }, - { - "title": "param", - "name": "near", - "lineNumber": 788 - }, - { - "title": "param", - "name": "far", - "lineNumber": 788 - } - ], - "properties": [ - { - "title": "property", - "name": "centerX", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "readonly": true, - "name": "perspective", - "kind": "function", - "memberof": "p5.Camera", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "perspective", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#perspective" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y coordinate representing center of the sketch" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "centerY" - }, - { - "title": "readonly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - }, - { - "title": "alt", - "description": "An example showing the use of camera object properties", - "lineNumber": 24 - } - ], - "loc": { - "start": { - "line": 609, - "column": 2, - "index": 18999 - }, - "end": { - "line": 636, - "column": 3, - "index": 19633 - } - }, - "context": { - "loc": { - "start": { - "line": 788, - "column": 2, - "index": 23195 - }, - "end": { - "line": 843, - "column": 3, - "index": 24944 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fovy", - "lineNumber": 788 - }, - { - "title": "param", - "name": "aspect", - "lineNumber": 788 - }, - { - "title": "param", - "name": "near", - "lineNumber": 788 - }, - { - "title": "param", - "name": "far", - "lineNumber": 788 - } - ], - "properties": [ - { - "title": "property", - "name": "centerY", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "readonly": true, - "name": "perspective", - "kind": "function", - "memberof": "p5.Camera", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "perspective", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#perspective" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z coordinate representing center of the sketch" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "centerZ" - }, - { - "title": "readonly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - }, - { - "title": "alt", - "description": "An example showing the use of camera object properties", - "lineNumber": 24 - } - ], - "loc": { - "start": { - "line": 638, - "column": 2, - "index": 19637 - }, - "end": { - "line": 665, - "column": 3, - "index": 20271 - } - }, - "context": { - "loc": { - "start": { - "line": 788, - "column": 2, - "index": 23195 - }, - "end": { - "line": 843, - "column": 3, - "index": 24944 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fovy", - "lineNumber": 788 - }, - { - "title": "param", - "name": "aspect", - "lineNumber": 788 - }, - { - "title": "param", - "name": "near", - "lineNumber": 788 - }, - { - "title": "param", - "name": "far", - "lineNumber": 788 - } - ], - "properties": [ - { - "title": "property", - "name": "centerZ", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "readonly": true, - "name": "perspective", - "kind": "function", - "memberof": "p5.Camera", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "perspective", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#perspective" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x component of direction 'up' from camera" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "upX" - }, - { - "title": "readonly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - }, - { - "title": "alt", - "description": "An example showing the use of camera object properties", - "lineNumber": 19 - } - ], - "loc": { - "start": { - "line": 667, - "column": 2, - "index": 20275 - }, - "end": { - "line": 689, - "column": 3, - "index": 20838 - } - }, - "context": { - "loc": { - "start": { - "line": 788, - "column": 2, - "index": 23195 - }, - "end": { - "line": 843, - "column": 3, - "index": 24944 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fovy", - "lineNumber": 788 - }, - { - "title": "param", - "name": "aspect", - "lineNumber": 788 - }, - { - "title": "param", - "name": "near", - "lineNumber": 788 - }, - { - "title": "param", - "name": "far", - "lineNumber": 788 - } - ], - "properties": [ - { - "title": "property", - "name": "upX", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "readonly": true, - "name": "perspective", - "kind": "function", - "memberof": "p5.Camera", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "perspective", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#perspective" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y component of direction 'up' from camera" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "upY" - }, - { - "title": "readonly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - }, - { - "title": "alt", - "description": "An example showing the use of camera object properties", - "lineNumber": 19 - } - ], - "loc": { - "start": { - "line": 691, - "column": 2, - "index": 20842 - }, - "end": { - "line": 713, - "column": 3, - "index": 21405 - } - }, - "context": { - "loc": { - "start": { - "line": 788, - "column": 2, - "index": 23195 - }, - "end": { - "line": 843, - "column": 3, - "index": 24944 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fovy", - "lineNumber": 788 - }, - { - "title": "param", - "name": "aspect", - "lineNumber": 788 - }, - { - "title": "param", - "name": "near", - "lineNumber": 788 - }, - { - "title": "param", - "name": "far", - "lineNumber": 788 - } - ], - "properties": [ - { - "title": "property", - "name": "upY", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "readonly": true, - "name": "perspective", - "kind": "function", - "memberof": "p5.Camera", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "perspective", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#perspective" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z component of direction 'up' from camera" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "upZ" - }, - { - "title": "readonly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - }, - { - "title": "alt", - "description": "An example showing the use of camera object properties", - "lineNumber": 19 - } - ], - "loc": { - "start": { - "line": 715, - "column": 2, - "index": 21409 - }, - "end": { - "line": 737, - "column": 3, - "index": 21972 - } - }, - "context": { - "loc": { - "start": { - "line": 788, - "column": 2, - "index": 23195 - }, - "end": { - "line": 843, - "column": 3, - "index": 24944 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fovy", - "lineNumber": 788 - }, - { - "title": "param", - "name": "aspect", - "lineNumber": 788 - }, - { - "title": "param", - "name": "near", - "lineNumber": 788 - }, - { - "title": "param", - "name": "far", - "lineNumber": 788 - } - ], - "properties": [ - { - "title": "property", - "name": "upZ", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "readonly": true, - "name": "perspective", - "kind": "function", - "memberof": "p5.Camera", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "perspective", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#perspective" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets a perspective projection.\nAccepts the same parameters as the global\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "perspective()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nMore information on this function can be found there." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.Camera", - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - }, - { - "title": "alt", - "description": "two colored 3D boxes move back and forth, rotating as mouse is dragged.", - "lineNumber": 42 - } - ], - "loc": { - "start": { - "line": 743, - "column": 2, - "index": 22174 - }, - "end": { - "line": 787, - "column": 3, - "index": 23192 - } - }, - "context": { - "loc": { - "start": { - "line": 788, - "column": 2, - "index": 23195 - }, - "end": { - "line": 843, - "column": 3, - "index": 24944 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fovy", - "lineNumber": 788 - }, - { - "title": "param", - "name": "aspect", - "lineNumber": 788 - }, - { - "title": "param", - "name": "near", - "lineNumber": 788 - }, - { - "title": "param", - "name": "far", - "lineNumber": 788 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "perspective", - "kind": "function", - "memberof": "p5.Camera", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "perspective", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#perspective" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets an orthographic projection.\nAccepts the same parameters as the global\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "ortho()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nMore information on this function can be found there." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.Camera", - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - }, - { - "title": "alt", - "description": "two 3D boxes move back and forth along same plane, rotating as mouse is dragged.", - "lineNumber": 40 - } - ], - "loc": { - "start": { - "line": 845, - "column": 2, - "index": 24948 - }, - "end": { - "line": 887, - "column": 3, - "index": 25980 - } - }, - "context": { - "loc": { - "start": { - "line": 888, - "column": 2, - "index": 25983 - }, - "end": { - "line": 926, - "column": 3, - "index": 27148 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "left", - "lineNumber": 888 - }, - { - "title": "param", - "name": "right", - "lineNumber": 888 - }, - { - "title": "param", - "name": "bottom", - "lineNumber": 888 - }, - { - "title": "param", - "name": "top", - "lineNumber": 888 - }, - { - "title": "param", - "name": "near", - "lineNumber": 888 - }, - { - "title": "param", - "name": "far", - "lineNumber": 888 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "ortho", - "kind": "function", - "memberof": "p5.Camera", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ortho", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#ortho" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the camera's frustum.\nAccepts the same parameters as the global\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "frustum()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nMore information on this function can be found there." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.Camera", - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - }, - { - "title": "alt", - "description": "two 3D boxes move back and forth along same plane, rotating as mouse is dragged.", - "lineNumber": 39 - } - ], - "loc": { - "start": { - "line": 928, - "column": 2, - "index": 27152 - }, - "end": { - "line": 969, - "column": 3, - "index": 28115 - } - }, - "context": { - "loc": { - "start": { - "line": 970, - "column": 2, - "index": 28118 - }, - "end": { - "line": 1007, - "column": 3, - "index": 29306 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "left", - "lineNumber": 970 - }, - { - "title": "param", - "name": "right", - "lineNumber": 970 - }, - { - "title": "param", - "name": "bottom", - "lineNumber": 970 - }, - { - "title": "param", - "name": "top", - "lineNumber": 970 - }, - { - "title": "param", - "name": "near", - "lineNumber": 970 - }, - { - "title": "param", - "name": "far", - "lineNumber": 970 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "frustum", - "kind": "function", - "memberof": "p5.Camera", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "frustum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#frustum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Panning rotates the camera view to the left and right." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "amount to rotate camera in current\nangleMode units.\nGreater than 0 values rotate counterclockwise (to the left).", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "angle" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - }, - { - "title": "alt", - "description": "camera view pans left and right across a series of rotating 3D boxes.", - "lineNumber": 51 - } - ], - "loc": { - "start": { - "line": 1057, - "column": 2, - "index": 30813 - }, - "end": { - "line": 1110, - "column": 3, - "index": 32041 - } - }, - "context": { - "loc": { - "start": { - "line": 1111, - "column": 2, - "index": 32044 - }, - "end": { - "line": 1114, - "column": 3, - "index": 32167 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "amount", - "lineNumber": 1111 - }, - { - "title": "param", - "name": "angle", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "amount to rotate camera in current\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " units.\nGreater than 0 values rotate counterclockwise (to the left)." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pan", - "kind": "function", - "memberof": "p5.Camera", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "pan", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#pan" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tilting rotates the camera view up and down." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "amount to rotate camera in current\nangleMode units.\nGreater than 0 values rotate counterclockwise (to the left).", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "angle" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - }, - { - "title": "alt", - "description": "camera view tilts up and down across a series of rotating 3D boxes.", - "lineNumber": 51 - } - ], - "loc": { - "start": { - "line": 1116, - "column": 2, - "index": 32171 - }, - "end": { - "line": 1169, - "column": 3, - "index": 33384 - } - }, - "context": { - "loc": { - "start": { - "line": 1170, - "column": 2, - "index": 33387 - }, - "end": { - "line": 1173, - "column": 3, - "index": 33511 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "amount", - "lineNumber": 1170 - }, - { - "title": "param", - "name": "angle", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "amount to rotate camera in current\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " units.\nGreater than 0 values rotate counterclockwise (to the left)." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "tilt", - "kind": "function", - "memberof": "p5.Camera", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "tilt", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#tilt" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reorients the camera to look at a position in world space." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.Camera", - "lineNumber": 2 - }, - { - "title": "param", - "description": "x position of a point in world space", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y position of a point in world space", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "z position of a point in world space", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - }, - { - "title": "alt", - "description": "camera view of rotating 3D cubes changes to look at a new random\npoint every second .", - "lineNumber": 46 - } - ], - "loc": { - "start": { - "line": 1175, - "column": 2, - "index": 33515 - }, - "end": { - "line": 1224, - "column": 3, - "index": 34689 - } - }, - "context": { - "loc": { - "start": { - "line": 1225, - "column": 2, - "index": 34692 - }, - "end": { - "line": 1237, - "column": 3, - "index": 34862 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x position of a point in world space" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y position of a point in world space" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z position of a point in world space" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "lookAt", - "kind": "function", - "memberof": "p5.Camera", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "lookAt", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#lookAt" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the camera's position and orientation.\nAccepts the same parameters as the global\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "camera()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nMore information on this function can be found there." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.Camera", - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - }, - { - "title": "alt", - "description": "White square repeatedly grows to fill canvas and then shrinks.", - "lineNumber": 27 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 30 - }, - { - "title": "alt", - "description": "An interactive example of a red cube with 3 sliders for moving it across x, y,\nz axis and 3 sliders for shifting its center.", - "lineNumber": 80 - } - ], - "loc": { - "start": { - "line": 1243, - "column": 2, - "index": 35062 - }, - "end": { - "line": 1326, - "column": 3, - "index": 37201 - } - }, - "context": { - "loc": { - "start": { - "line": 1327, - "column": 2, - "index": 37204 - }, - "end": { - "line": 1388, - "column": 3, - "index": 38622 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - }, - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "eyeX", - "lineNumber": 1328 - }, - { - "title": "param", - "name": "eyeY", - "lineNumber": 1329 - }, - { - "title": "param", - "name": "eyeZ", - "lineNumber": 1330 - }, - { - "title": "param", - "name": "centerX", - "lineNumber": 1331 - }, - { - "title": "param", - "name": "centerY", - "lineNumber": 1332 - }, - { - "title": "param", - "name": "centerZ", - "lineNumber": 1333 - }, - { - "title": "param", - "name": "upX", - "lineNumber": 1334 - }, - { - "title": "param", - "name": "upY", - "lineNumber": 1335 - }, - { - "title": "param", - "name": "upZ", - "lineNumber": 1336 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "camera", - "kind": "function", - "memberof": "p5.Camera", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "camera", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#camera" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Move camera along its local axes while maintaining current camera orientation." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "amount to move along camera's left-right axis", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "amount to move along camera's up-down axis", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "amount to move along camera's forward-backward axis", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - }, - { - "title": "alt", - "description": "camera view moves along a series of 3D boxes, maintaining the same\norientation throughout the move", - "lineNumber": 47 - } - ], - "loc": { - "start": { - "line": 1390, - "column": 2, - "index": 38626 - }, - "end": { - "line": 1440, - "column": 3, - "index": 39954 - } - }, - "context": { - "loc": { - "start": { - "line": 1441, - "column": 2, - "index": 39957 - }, - "end": { - "line": 1461, - "column": 3, - "index": 40666 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "amount to move along camera's left-right axis" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "amount to move along camera's up-down axis" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "amount to move along camera's forward-backward axis" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "move", - "kind": "function", - "memberof": "p5.Camera", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "move", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#move" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Set camera position in world-space while maintaining current camera\norientation." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "x position of a point in world space", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y position of a point in world space", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "z position of a point in world space", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - }, - { - "title": "alt", - "description": "camera position changes as the user presses keys, altering view of a 3D box", - "lineNumber": 42 - } - ], - "loc": { - "start": { - "line": 1463, - "column": 2, - "index": 40670 - }, - "end": { - "line": 1507, - "column": 3, - "index": 41697 - } - }, - "context": { - "loc": { - "start": { - "line": 1508, - "column": 2, - "index": 41700 - }, - "end": { - "line": 1524, - "column": 3, - "index": 42008 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x position of a point in world space" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y position of a point in world space" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z position of a point in world space" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setPosition", - "kind": "function", - "memberof": "p5.Camera", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setPosition", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#setPosition" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "source camera", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Camera" - }, - "name": "cam" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 43 - } - ], - "loc": { - "start": { - "line": 1526, - "column": 2, - "index": 42012 - }, - "end": { - "line": 1575, - "column": 3, - "index": 43444 - } - }, - "context": { - "loc": { - "start": { - "line": 1576, - "column": 2, - "index": 43447 - }, - "end": { - "line": 1596, - "column": 3, - "index": 44124 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "cam", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "source camera" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Camera" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "set", - "kind": "function", - "memberof": "p5.Camera", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "set", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#set" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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()." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "first p5.Camera", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "p5.Camera" - }, - "name": "cam0" - }, - { - "title": "param", - "description": "second p5.Camera", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "p5.Camera" - }, - "name": "cam1" - }, - { - "title": "param", - "description": "amount to use for interpolation during slerp", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "amt" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 17 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 58 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 64 - }, - { - "title": "alt", - "description": "There 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.", - "lineNumber": 115 - } - ], - "loc": { - "start": { - "line": 1598, - "column": 2, - "index": 44128 - }, - "end": { - "line": 1717, - "column": 3, - "index": 48514 - } - }, - "context": { - "loc": { - "start": { - "line": 1718, - "column": 2, - "index": 48517 - }, - "end": { - "line": 1910, - "column": 3, - "index": 56909 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - }, - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "cam0", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "first p5.Camera" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Camera" - } - }, - { - "title": "param", - "name": "cam1", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "second p5.Camera" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Camera" - } - }, - { - "title": "param", - "name": "amt", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "amount to use for interpolation during slerp" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "slerp", - "kind": "function", - "memberof": "p5.Camera", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "slerp", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#slerp" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Resizes the framebuffer to the given width and height." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "width" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "height" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - }, - { - "title": "alt", - "description": "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", - "lineNumber": 38 - } - ], - "loc": { - "start": { - "line": 162, - "column": 2, - "index": 5258 - }, - "end": { - "line": 204, - "column": 5, - "index": 6246 - } - }, - "context": { - "loc": { - "start": { - "line": 205, - "column": 2, - "index": 6249 - }, - "end": { - "line": 210, - "column": 3, - "index": 6380 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Framebuffer.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "width", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "height", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "resize", - "kind": "function", - "memberof": "p5.Framebuffer", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "resize", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#resize" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Call this method with no arguments to get the current density, or pass\nin a number to set the density." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "A scaling factor for the number of pixels per\nside of the framebuffer", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "density" - } - ], - "loc": { - "start": { - "line": 212, - "column": 2, - "index": 6384 - }, - "end": { - "line": 222, - "column": 5, - "index": 6825 - } - }, - "context": { - "loc": { - "start": { - "line": 223, - "column": 2, - "index": 6828 - }, - "end": { - "line": 231, - "column": 3, - "index": 7008 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Framebuffer.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "density", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A scaling factor for the number of pixels per\nside of the framebuffer" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pixelDensity", - "kind": "function", - "memberof": "p5.Framebuffer", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "pixelDensity", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#pixelDensity" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Call this method with no arguments to see if it is currently auto-sized,\nor pass in a boolean to set this property." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Whether or not the framebuffer should resize\nalong with the canvas it's attached to", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - }, - "name": "autoSized" - } - ], - "loc": { - "start": { - "line": 233, - "column": 2, - "index": 7012 - }, - "end": { - "line": 242, - "column": 5, - "index": 7428 - } - }, - "context": { - "loc": { - "start": { - "line": 243, - "column": 2, - "index": 7431 - }, - "end": { - "line": 250, - "column": 3, - "index": 7602 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Framebuffer.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "autoSized", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Whether or not the framebuffer should resize\nalong with the canvas it's attached to" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "autoSized", - "kind": "function", - "memberof": "p5.Framebuffer", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "autoSized", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#autoSized" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates and returns a new\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.FramebufferCamera" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to be used\nwhile drawing to this framebuffer. The camera will be set as the\ncurrently active camera." - } - ] - } - ] - }, - "tags": [ - { - "title": "returns", - "description": "A new camera", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "p5.Camera" - } - } - ], - "loc": { - "start": { - "line": 673, - "column": 2, - "index": 20297 - }, - "end": { - "line": 680, - "column": 5, - "index": 20555 - } - }, - "context": { - "loc": { - "start": { - "line": 681, - "column": 2, - "index": 20558 - }, - "end": { - "line": 687, - "column": 3, - "index": 20753 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Framebuffer.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A new camera" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Camera" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createCamera", - "kind": "function", - "memberof": "p5.Framebuffer", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createCamera", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#createCamera" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes the framebuffer and frees its resources." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 3 - }, - { - "title": "alt", - "description": "A rotating red cube blinks on and off every second.", - "lineNumber": 39 - } - ], - "loc": { - "start": { - "line": 703, - "column": 2, - "index": 21119 - }, - "end": { - "line": 744, - "column": 5, - "index": 22177 - } - }, - "context": { - "loc": { - "start": { - "line": 745, - "column": 2, - "index": 22180 - }, - "end": { - "line": 760, - "column": 3, - "index": 22675 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Framebuffer.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "remove", - "kind": "function", - "memberof": "p5.Framebuffer", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "remove", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#remove" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "end()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 37 - } - ], - "loc": { - "start": { - "line": 762, - "column": 2, - "index": 22679 - }, - "end": { - "line": 802, - "column": 5, - "index": 23948 - } - }, - "context": { - "loc": { - "start": { - "line": 803, - "column": 2, - "index": 23951 - }, - "end": { - "line": 818, - "column": 3, - "index": 24535 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Framebuffer.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "begin", - "kind": "function", - "memberof": "p5.Framebuffer", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "begin", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#begin" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "After having previously called\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "begin()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", 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." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 885, - "column": 2, - "index": 26372 - }, - "end": { - "line": 891, - "column": 5, - "index": 26664 - } - }, - "context": { - "loc": { - "start": { - "line": 892, - "column": 2, - "index": 26667 - }, - "end": { - "line": 910, - "column": 3, - "index": 27287 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Framebuffer.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "end", - "kind": "function", - "memberof": "p5.Framebuffer", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "end", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#end" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Run a function while drawing to the framebuffer rather than to its canvas.\nThis is equivalent to calling " - }, - { - "type": "inlineCode", - "value": "framebuffer.begin()" - }, - { - "type": "text", - "value": ", running the function,\nand then calling " - }, - { - "type": "inlineCode", - "value": "framebuffer.end()" - }, - { - "type": "text", - "value": ", but ensures that one never\naccidentally forgets " - }, - { - "type": "inlineCode", - "value": "begin" - }, - { - "type": "text", - "value": " or " - }, - { - "type": "inlineCode", - "value": "end" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "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.", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Function" - }, - "name": "callback" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 39 - } - ], - "loc": { - "start": { - "line": 912, - "column": 2, - "index": 27291 - }, - "end": { - "line": 954, - "column": 5, - "index": 28622 - } - }, - "context": { - "loc": { - "start": { - "line": 955, - "column": 2, - "index": 28625 - }, - "end": { - "line": 959, - "column": 3, - "index": 28695 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Framebuffer.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "callback", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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": { - "type": "NameExpression", - "name": "Function" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "draw", - "kind": "function", - "memberof": "p5.Framebuffer", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "draw", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#draw" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Call this befpre updating " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixels" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nand calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "updatePixels" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nto replace the content of the framebuffer with the data in the pixels\narray." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 961, - "column": 2, - "index": 28699 - }, - "end": { - "line": 966, - "column": 5, - "index": 28945 - } - }, - "context": { - "loc": { - "start": { - "line": 967, - "column": 2, - "index": 28948 - }, - "end": { - "line": 988, - "column": 3, - "index": 29569 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Framebuffer.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "loadPixels", - "kind": "function", - "memberof": "p5.Framebuffer", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "loadPixels", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#loadPixels" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Get a region of pixels from the canvas in the form of a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", or a single pixel as an array of\nnumbers." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "imageMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "x-coordinate of the pixel", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y-coordinate of the pixel", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "width of the section to be returned", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "w" - }, - { - "title": "param", - "description": "height of the section to be returned", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "h" - }, - { - "title": "return", - "description": "the rectangle p5.Image", - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "p5.Image" - } - } - ], - "loc": { - "start": { - "line": 990, - "column": 2, - "index": 29573 - }, - "end": { - "line": 1009, - "column": 5, - "index": 30670 - } - }, - "context": { - "loc": { - "start": { - "line": 1018, - "column": 2, - "index": 30912 - }, - "end": { - "line": 1104, - "column": 3, - "index": 33829 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Framebuffer.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the pixel" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the pixel" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "w", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "width of the section to be returned" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "h", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "height of the section to be returned" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the rectangle " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Image" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "get", - "kind": "function", - "memberof": "p5.Framebuffer", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "get", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#get" - }, - { - "description": "", - "tags": [ - { - "title": "return", - "description": "the whole p5.Image", - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "p5.Image" - } - } - ], - "loc": { - "start": { - "line": 1010, - "column": 2, - "index": 30673 - }, - "end": { - "line": 1012, - "column": 5, - "index": 30755 - } - }, - "context": { - "loc": { - "start": { - "line": 1018, - "column": 2, - "index": 30912 - }, - "end": { - "line": 1104, - "column": 3, - "index": 33829 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Framebuffer.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 1018 - }, - { - "title": "param", - "name": "y", - "lineNumber": 1018 - }, - { - "title": "param", - "name": "w", - "lineNumber": 1018 - }, - { - "title": "param", - "name": "h", - "lineNumber": 1018 - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the whole " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Image" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "get", - "kind": "function", - "memberof": "p5.Framebuffer", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "get", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#get" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": null, - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "return", - "description": "color of pixel at x,y in array format [R, G, B, A]", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "loc": { - "start": { - "line": 1013, - "column": 2, - "index": 30758 - }, - "end": { - "line": 1017, - "column": 5, - "index": 30909 - } - }, - "context": { - "loc": { - "start": { - "line": 1018, - "column": 2, - "index": 30912 - }, - "end": { - "line": 1104, - "column": 3, - "index": 33829 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Framebuffer.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "w", - "lineNumber": 1018 - }, - { - "title": "param", - "name": "h", - "lineNumber": 1018 - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "color of pixel at x,y in array format [R, G, B, A]" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "get", - "kind": "function", - "memberof": "p5.Framebuffer", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "get", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#get" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Call this after initially calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nloadPixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and updating " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixels" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nto replace the content of the framebuffer with the data in the pixels\narray." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This will also clear the depth buffer so that any future drawing done\nafterwards will go on top." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 57 - } - ], - "loc": { - "start": { - "line": 1106, - "column": 2, - "index": 33833 - }, - "end": { - "line": 1167, - "column": 5, - "index": 35621 - } - }, - "context": { - "loc": { - "start": { - "line": 1168, - "column": 2, - "index": 35624 - }, - "end": { - "line": 1237, - "column": 3, - "index": 37820 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Framebuffer.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "updatePixels", - "kind": "function", - "memberof": "p5.Framebuffer", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "updatePixels", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#updatePixels" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes the internal colors of p5.Geometry.\nUsing " - }, - { - "type": "inlineCode", - "value": "clearColors()" - }, - { - "type": "text", - "value": ", you can use " - }, - { - "type": "inlineCode", - "value": "fill()" - }, - { - "type": "text", - "value": " to supply new colors before drawing each shape.\nIf " - }, - { - "type": "inlineCode", - "value": "clearColors()" - }, - { - "type": "text", - "value": " is not used, the shapes will use their internal colors by ignoring " - }, - { - "type": "inlineCode", - "value": "fill()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 90, - "column": 2, - "index": 3095 - }, - "end": { - "line": 137, - "column": 5, - "index": 4645 - } - }, - "context": { - "loc": { - "start": { - "line": 138, - "column": 2, - "index": 4648 - }, - "end": { - "line": 141, - "column": 3, - "index": 4712 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Geometry.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clearColors", - "kind": "function", - "memberof": "p5.Geometry", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "clearColors", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#clearColors" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "computes faces for geometry objects based on the vertices." - } - ] - } - ] - }, - "tags": [ - { - "title": "chainable", - "description": null, - "lineNumber": 2 - } - ], - "loc": { - "start": { - "line": 286, - "column": 2, - "index": 7295 - }, - "end": { - "line": 289, - "column": 3, - "index": 7378 - } - }, - "context": { - "loc": { - "start": { - "line": 290, - "column": 2, - "index": 7381 - }, - "end": { - "line": 305, - "column": 3, - "index": 7884 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Geometry.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "computeFaces", - "kind": "function", - "memberof": "p5.Geometry", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "computeFaces", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#computeFaces" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When using " - }, - { - "type": "inlineCode", - "value": "FLAT" - }, - { - "type": "text", - "value": " shading, vertices are disconnected/duplicated i.e each face has its own copy of vertices.\nWhen using " - }, - { - "type": "inlineCode", - "value": "SMOOTH" - }, - { - "type": "text", - "value": " shading, vertices are connected/deduplicated i.e each face has its vertices shared with other faces." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Options can include:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "roundToPrecision" - }, - { - "type": "text", - "value": ": Precision value for rounding computations. Defaults to 3." - } - ] - } - ] - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "shading type (`FLAT` for flat shading or `SMOOTH` for smooth shading) for buildGeometry() outputs. Defaults to `FLAT`.", - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "shadingType" - }, - { - "title": "param", - "description": "An optional object with configuration.", - "lineNumber": 11, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - }, - "name": "options" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 12 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 14 - }, - { - "title": "alt", - "description": "A 3D helix using the computeNormals() function by default uses `FLAT` to create a flat shading effect on the helix.", - "lineNumber": 48 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 51 - }, - { - "title": "alt", - "description": "A 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.", - "lineNumber": 91 - } - ], - "loc": { - "start": { - "line": 328, - "column": 2, - "index": 8665 - }, - "end": { - "line": 422, - "column": 5, - "index": 11553 - } - }, - "context": { - "loc": { - "start": { - "line": 423, - "column": 2, - "index": 11556 - }, - "end": { - "line": 496, - "column": 3, - "index": 13942 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Geometry.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - }, - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "shadingType", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "shading type (" - }, - { - "type": "inlineCode", - "value": "FLAT" - }, - { - "type": "text", - "value": " for flat shading or " - }, - { - "type": "inlineCode", - "value": "SMOOTH" - }, - { - "type": "text", - "value": " for smooth shading) for buildGeometry() outputs. Defaults to " - }, - { - "type": "inlineCode", - "value": "FLAT" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "default": "constants.FLAT" - }, - { - "title": "param", - "name": "options", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An optional object with configuration." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - }, - "properties": [ - { - "title": "param", - "name": "options.roundToPrecision", - "lineNumber": 423, - "default": "3" - } - ], - "default": "{}" - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "computeNormals", - "kind": "function", - "memberof": "p5.Geometry", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "computeNormals", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#computeNormals" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Averages the vertex normals. Used in curved\nsurfaces" - } - ] - } - ] - }, - "tags": [ - { - "title": "chainable", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 498, - "column": 2, - "index": 13946 - }, - "end": { - "line": 502, - "column": 3, - "index": 14026 - } - }, - "context": { - "loc": { - "start": { - "line": 503, - "column": 2, - "index": 14029 - }, - "end": { - "line": 516, - "column": 3, - "index": 14437 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Geometry.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "averageNormals", - "kind": "function", - "memberof": "p5.Geometry", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "averageNormals", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#averageNormals" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Averages pole normals. Used in spherical primitives" - } - ] - } - ] - }, - "tags": [ - { - "title": "chainable", - "description": null, - "lineNumber": 2 - } - ], - "loc": { - "start": { - "line": 518, - "column": 2, - "index": 14441 - }, - "end": { - "line": 521, - "column": 3, - "index": 14518 - } - }, - "context": { - "loc": { - "start": { - "line": 522, - "column": 2, - "index": 14521 - }, - "end": { - "line": 553, - "column": 3, - "index": 15283 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Geometry.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "averagePoleNormals", - "kind": "function", - "memberof": "p5.Geometry", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "averagePoleNormals", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#averagePoleNormals" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Modifies all vertices to be centered within the range -100 to 100." - } - ] - } - ] - }, - "tags": [ - { - "title": "chainable", - "description": null, - "lineNumber": 2 - } - ], - "loc": { - "start": { - "line": 827, - "column": 2, - "index": 23531 - }, - "end": { - "line": 830, - "column": 3, - "index": 23622 - } - }, - "context": { - "loc": { - "start": { - "line": 831, - "column": 2, - "index": 23625 - }, - "end": { - "line": 857, - "column": 3, - "index": 24705 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Geometry.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "normalize", - "kind": "function", - "memberof": "p5.Geometry", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "normalize", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#normalize" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Replace the entire contents of a 4x4 matrix.\nIf providing an array or a p5.Matrix, the values will be copied without\nreferencing the source object.\nCan also provide 16 numbers as individual arguments." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "the input p5.Matrix or\n an Array of length 16", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Matrix" - }, - { - "type": "NameExpression", - "name": "Float32Array" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - } - }, - "name": "inMatrix" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 49, - "column": 2, - "index": 1404 - }, - "end": { - "line": 58, - "column": 3, - "index": 1780 - } - }, - "context": { - "loc": { - "start": { - "line": 64, - "column": 2, - "index": 1927 - }, - "end": { - "line": 82, - "column": 3, - "index": 2396 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "inMatrix", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the input p5.Matrix or\nan Array of length 16" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Matrix" - }, - { - "type": "NameExpression", - "name": "Float32Array" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "set", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "set", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#set" - }, - { - "description": "", - "tags": [ - { - "title": "param", - "description": "16 numbers passed by value to avoid\n array copying.", - "lineNumber": 1, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "elements" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 59, - "column": 2, - "index": 1783 - }, - "end": { - "line": 63, - "column": 3, - "index": 1924 - } - }, - "context": { - "loc": { - "start": { - "line": 64, - "column": 2, - "index": 1927 - }, - "end": { - "line": 82, - "column": 3, - "index": 2396 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "inMatrix", - "lineNumber": 64 - }, - { - "title": "param", - "name": "elements", - "lineNumber": 1, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "16 numbers passed by value to avoid\narray copying." - } - ] - } - ] - }, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "set", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "set", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#set" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Gets a copy of the vector, returns a p5.Matrix object." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "the copy of the p5.Matrix object", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Matrix" - } - } - ], - "loc": { - "start": { - "line": 84, - "column": 2, - "index": 2400 - }, - "end": { - "line": 88, - "column": 3, - "index": 2524 - } - }, - "context": { - "loc": { - "start": { - "line": 89, - "column": 2, - "index": 2527 - }, - "end": { - "line": 91, - "column": 3, - "index": 2584 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the copy of the p5.Matrix object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Matrix" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "get", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "get", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#get" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "return a copy of this matrix.\nIf this matrix is 4x4, a 4x4 matrix with exactly the same entries will be\ngenerated. The same is true if this matrix is 3x3." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "the result matrix", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Matrix" - } - } - ], - "loc": { - "start": { - "line": 93, - "column": 2, - "index": 2588 - }, - "end": { - "line": 99, - "column": 3, - "index": 2805 - } - }, - "context": { - "loc": { - "start": { - "line": 100, - "column": 2, - "index": 2808 - }, - "end": { - "line": 132, - "column": 3, - "index": 3935 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the result matrix" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Matrix" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "copy", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "copy", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#copy" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "transpose according to a given matrix" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "the matrix to be\n based on to transpose", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Matrix" - }, - { - "type": "NameExpression", - "name": "Float32Array" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - }, - "name": "a" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 142, - "column": 2, - "index": 4085 - }, - "end": { - "line": 147, - "column": 3, - "index": 4283 - } - }, - "context": { - "loc": { - "start": { - "line": 148, - "column": 2, - "index": 4286 - }, - "end": { - "line": 200, - "column": 3, - "index": 5608 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "a", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the matrix to be\nbased on to transpose" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Matrix" - }, - { - "type": "NameExpression", - "name": "Float32Array" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "transpose", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "transpose", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#transpose" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "invert matrix according to a give matrix" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "the matrix to be\n based on to invert", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Matrix" - }, - { - "type": "NameExpression", - "name": "Float32Array" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - }, - "name": "a" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 202, - "column": 2, - "index": 5612 - }, - "end": { - "line": 207, - "column": 3, - "index": 5813 - } - }, - "context": { - "loc": { - "start": { - "line": 208, - "column": 2, - "index": 5816 - }, - "end": { - "line": 286, - "column": 3, - "index": 8341 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "a", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the matrix to be\nbased on to invert" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Matrix" - }, - { - "type": "NameExpression", - "name": "Float32Array" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "invert", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "invert", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#invert" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Inverts a 3×3 matrix" - } - ] - } - ] - }, - "tags": [ - { - "title": "chainable", - "description": null, - "lineNumber": 2 - } - ], - "loc": { - "start": { - "line": 288, - "column": 2, - "index": 8345 - }, - "end": { - "line": 291, - "column": 3, - "index": 8390 - } - }, - "context": { - "loc": { - "start": { - "line": 292, - "column": 2, - "index": 8393 - }, - "end": { - "line": 322, - "column": 3, - "index": 9353 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "invert3x3", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "invert3x3", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#invert3x3" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is only for 3x3 matrices.\ntransposes a 3×3 p5.Matrix by a mat3\nIf there is an array of arguments, the matrix obtained by transposing\nthe 3x3 matrix generated based on that array is set.\nIf no arguments, it transposes itself and returns it." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "1-dimensional array", - "lineNumber": 7, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "mat3" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 324, - "column": 2, - "index": 9357 - }, - "end": { - "line": 333, - "column": 3, - "index": 9697 - } - }, - "context": { - "loc": { - "start": { - "line": 334, - "column": 2, - "index": 9700 - }, - "end": { - "line": 352, - "column": 3, - "index": 10117 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "mat3", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "1-dimensional array" - } - ] - } - ] - }, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "transpose3x3", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "transpose3x3", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#transpose3x3" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "converts a 4×4 matrix to its 3×3 inverse transform\ncommonly used in MVMatrix to NMatrix conversions." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "the matrix to be based on to invert", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Matrix" - }, - "name": "mat4" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - }, - { - "title": "todo", - "description": "finish implementation", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 354, - "column": 2, - "index": 10121 - }, - "end": { - "line": 360, - "column": 3, - "index": 10345 - } - }, - "context": { - "loc": { - "start": { - "line": 361, - "column": 2, - "index": 10348 - }, - "end": { - "line": 388, - "column": 3, - "index": 11088 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "mat4", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the matrix to be based on to invert" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Matrix" - }, - "properties": [ - { - "title": "param", - "name": "mat4.mat4", - "lineNumber": 361 - } - ] - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [ - { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "finish implementation" - } - ] - } - ] - } - ], - "yields": [], - "name": "inverseTranspose", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "inverseTranspose", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#inverseTranspose" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "inspired by Toji's mat4 determinant" - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Determinant of our 4×4 matrix", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "loc": { - "start": { - "line": 390, - "column": 2, - "index": 11092 - }, - "end": { - "line": 393, - "column": 3, - "index": 11188 - } - }, - "context": { - "loc": { - "start": { - "line": 394, - "column": 2, - "index": 11191 - }, - "end": { - "line": 411, - "column": 3, - "index": 12204 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Determinant of our 4×4 matrix" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "determinant", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "determinant", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#determinant" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "multiply two mat4s" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The matrix\n we want to multiply by", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Matrix" - }, - { - "type": "NameExpression", - "name": "Float32Array" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - }, - "name": "multMatrix" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 413, - "column": 2, - "index": 12208 - }, - "end": { - "line": 418, - "column": 3, - "index": 12390 - } - }, - "context": { - "loc": { - "start": { - "line": 419, - "column": 2, - "index": 12393 - }, - "end": { - "line": 472, - "column": 3, - "index": 14556 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "multMatrix", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The matrix\nwe want to multiply by" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Matrix" - }, - { - "type": "NameExpression", - "name": "Float32Array" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mult", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mult", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#mult" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "scales a p5.Matrix by scalars or a vector" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "vector to scale by", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "NameExpression", - "name": "Float32Array" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - }, - "name": "s" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 531, - "column": 2, - "index": 16713 - }, - "end": { - "line": 535, - "column": 3, - "index": 16845 - } - }, - "context": { - "loc": { - "start": { - "line": 536, - "column": 2, - "index": 16848 - }, - "end": { - "line": 563, - "column": 3, - "index": 17475 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 536 - }, - { - "title": "param", - "name": "y", - "lineNumber": 536 - }, - { - "title": "param", - "name": "z", - "lineNumber": 536 - }, - { - "title": "param", - "name": "s", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "vector to scale by" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "NameExpression", - "name": "Float32Array" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "scale", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "scale", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#scale" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "rotate our Matrix around an axis by the given angle." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The angle of rotation in radians", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "a" - }, - { - "title": "param", - "description": "the axis(es) to rotate around", - "lineNumber": 3, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - }, - "name": "axis" - }, - { - "title": "chainable", - "description": "inspired by Toji's gl-matrix lib, mat4 rotation", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 565, - "column": 2, - "index": 17479 - }, - "end": { - "line": 571, - "column": 3, - "index": 17730 - } - }, - "context": { - "loc": { - "start": { - "line": 572, - "column": 2, - "index": 17733 - }, - "end": { - "line": 633, - "column": 3, - "index": 19746 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "a", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The angle of rotation in radians" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x", - "lineNumber": 572 - }, - { - "title": "param", - "name": "y", - "lineNumber": 572 - }, - { - "title": "param", - "name": "z", - "lineNumber": 572 - }, - { - "title": "param", - "name": "axis", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the axis(es) to rotate around" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotate", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "rotate", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#rotate" - }, - { - "description": "", - "tags": [ - { - "title": "todo", - "description": "finish implementing this method!\ntranslates", - "lineNumber": 1 - }, - { - "title": "param", - "description": "vector to translate by", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "v" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 635, - "column": 2, - "index": 19750 - }, - "end": { - "line": 640, - "column": 3, - "index": 19875 - } - }, - "context": { - "loc": { - "start": { - "line": 641, - "column": 2, - "index": 19878 - }, - "end": { - "line": 649, - "column": 3, - "index": 20263 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "vector to translate by" - } - ] - } - ] - }, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [ - { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "finish implementing this method!\ntranslates" - } - ] - } - ] - } - ], - "yields": [], - "name": "translate", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "translate", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#translate" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "sets the perspective matrix" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "[description]", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "fovy" - }, - { - "title": "param", - "description": "[description]", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "aspect" - }, - { - "title": "param", - "description": "near clipping plane", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "near" - }, - { - "title": "param", - "description": "far clipping plane", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "far" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 661, - "column": 2, - "index": 20412 - }, - "end": { - "line": 668, - "column": 3, - "index": 20639 - } - }, - "context": { - "loc": { - "start": { - "line": 669, - "column": 2, - "index": 20642 - }, - "end": { - "line": 691, - "column": 3, - "index": 21174 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "fovy", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "[description]" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "aspect", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "[description]" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "near", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "near clipping plane" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "far", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "far clipping plane" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "perspective", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "perspective", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#perspective" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "sets the ortho matrix" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "[description]", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "left" - }, - { - "title": "param", - "description": "[description]", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "right" - }, - { - "title": "param", - "description": "[description]", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "bottom" - }, - { - "title": "param", - "description": "[description]", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "top" - }, - { - "title": "param", - "description": "near clipping plane", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "near" - }, - { - "title": "param", - "description": "far clipping plane", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "far" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 693, - "column": 2, - "index": 21178 - }, - "end": { - "line": 702, - "column": 3, - "index": 21481 - } - }, - "context": { - "loc": { - "start": { - "line": 703, - "column": 2, - "index": 21484 - }, - "end": { - "line": 725, - "column": 3, - "index": 22072 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "left", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "[description]" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "right", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "[description]" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "bottom", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "[description]" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "top", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "[description]" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "near", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "near clipping plane" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "far", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "far clipping plane" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "ortho", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ortho", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#ortho" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "apply a matrix to a vector with x,y,z,w components\nget the results in the form of an array" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": null, - "name": "Number" - }, - { - "title": "return", - "description": null, - "lineNumber": 4, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "loc": { - "start": { - "line": 727, - "column": 2, - "index": 22076 - }, - "end": { - "line": 732, - "column": 3, - "index": 22221 - } - }, - "context": { - "loc": { - "start": { - "line": 733, - "column": 2, - "index": 22224 - }, - "end": { - "line": 743, - "column": 3, - "index": 22575 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 733 - }, - { - "title": "param", - "name": "y", - "lineNumber": 733 - }, - { - "title": "param", - "name": "z", - "lineNumber": 733 - }, - { - "title": "param", - "name": "w", - "lineNumber": 733 - }, - { - "title": "param", - "name": "Number", - "lineNumber": 3 - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "multiplyVec4", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "multiplyVec4", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#multiplyVec4" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Applies a matrix to a vector.\nThe fourth component is set to 1.\nReturns a vector consisting of the first\nthrough third components of the result." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": null, - "name": "p5.Vector" - }, - { - "title": "return", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "loc": { - "start": { - "line": 745, - "column": 2, - "index": 22579 - }, - "end": { - "line": 753, - "column": 3, - "index": 22791 - } - }, - "context": { - "loc": { - "start": { - "line": 754, - "column": 2, - "index": 22794 - }, - "end": { - "line": 757, - "column": 3, - "index": 22931 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "$0", - "anonymous": true, - "type": { - "type": "NameExpression", - "name": "Object" - }, - "properties": [ - { - "title": "param", - "name": "$0.x", - "lineNumber": 754 - }, - { - "title": "param", - "name": "$0.y", - "lineNumber": 754 - }, - { - "title": "param", - "name": "$0.z", - "lineNumber": 754 - } - ] - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "multiplyPoint", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "multiplyPoint", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#multiplyPoint" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Applies a matrix to a vector.\nThe fourth component is set to 1.\nReturns the result of dividing the 1st to 3rd components\nof the result by the 4th component as a vector." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": null, - "name": "p5.Vector" - }, - { - "title": "return", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "loc": { - "start": { - "line": 759, - "column": 2, - "index": 22935 - }, - "end": { - "line": 767, - "column": 3, - "index": 23171 - } - }, - "context": { - "loc": { - "start": { - "line": 768, - "column": 2, - "index": 23174 - }, - "end": { - "line": 774, - "column": 3, - "index": 23401 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "$0", - "anonymous": true, - "type": { - "type": "NameExpression", - "name": "Object" - }, - "properties": [ - { - "title": "param", - "name": "$0.x", - "lineNumber": 768 - }, - { - "title": "param", - "name": "$0.y", - "lineNumber": 768 - }, - { - "title": "param", - "name": "$0.z", - "lineNumber": 768 - } - ] - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "multiplyAndNormalizePoint", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "multiplyAndNormalizePoint", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#multiplyAndNormalizePoint" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Applies a matrix to a vector.\nThe fourth component is set to 0.\nReturns a vector consisting of the first\nthrough third components of the result." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": null, - "name": "p5.Vector" - }, - { - "title": "return", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "loc": { - "start": { - "line": 776, - "column": 2, - "index": 23405 - }, - "end": { - "line": 784, - "column": 3, - "index": 23617 - } - }, - "context": { - "loc": { - "start": { - "line": 785, - "column": 2, - "index": 23620 - }, - "end": { - "line": 788, - "column": 3, - "index": 23761 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "$0", - "anonymous": true, - "type": { - "type": "NameExpression", - "name": "Object" - }, - "properties": [ - { - "title": "param", - "name": "$0.x", - "lineNumber": 785 - }, - { - "title": "param", - "name": "$0.y", - "lineNumber": 785 - }, - { - "title": "param", - "name": "$0.z", - "lineNumber": 785 - } - ] - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "multiplyDirection", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "multiplyDirection", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#multiplyDirection" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is only for 3x3 matrices.\nmultiply two mat3s. It is an operation to multiply the 3x3 matrix of\nthe argument from the right. Arguments can be a 3x3 p5.Matrix,\na Float32Array of length 9, or a javascript array of length 9.\nIn addition, it can also be done by enumerating 9 numbers." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The matrix\n we want to multiply by", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Matrix" - }, - { - "type": "NameExpression", - "name": "Float32Array" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - }, - "name": "multMatrix" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 790, - "column": 2, - "index": 23765 - }, - "end": { - "line": 800, - "column": 3, - "index": 24237 - } - }, - "context": { - "loc": { - "start": { - "line": 801, - "column": 2, - "index": 24240 - }, - "end": { - "line": 839, - "column": 3, - "index": 25528 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "multMatrix", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The matrix\nwe want to multiply by" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Matrix" - }, - { - "type": "NameExpression", - "name": "Float32Array" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mult3x3", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mult3x3", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#mult3x3" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is only for 3x3 matrices.\nA function that returns a column vector of a 3x3 matrix." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "matrix column number", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "columnIndex" - }, - { - "title": "return", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "loc": { - "start": { - "line": 841, - "column": 2, - "index": 25532 - }, - "end": { - "line": 847, - "column": 3, - "index": 25720 - } - }, - "context": { - "loc": { - "start": { - "line": 848, - "column": 2, - "index": 25723 - }, - "end": { - "line": 854, - "column": 3, - "index": 25890 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "columnIndex", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "matrix column number" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "column", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "column", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#column" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is only for 3x3 matrices.\nA function that returns a row vector of a 3x3 matrix." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "matrix row number", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rowIndex" - }, - { - "title": "return", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "loc": { - "start": { - "line": 856, - "column": 2, - "index": 25894 - }, - "end": { - "line": 862, - "column": 3, - "index": 26073 - } - }, - "context": { - "loc": { - "start": { - "line": 863, - "column": 2, - "index": 26076 - }, - "end": { - "line": 869, - "column": 3, - "index": 26216 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "rowIndex", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "matrix row number" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "row", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "row", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#row" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the diagonal elements of the matrix in the form of an array.\nA 3x3 matrix will return an array of length 3.\nA 4x4 matrix will return an array of length 4." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "An array obtained by arranging the diagonal elements\n of the matrix in ascending order of index", - "lineNumber": 5, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "loc": { - "start": { - "line": 871, - "column": 2, - "index": 26220 - }, - "end": { - "line": 878, - "column": 3, - "index": 26541 - } - }, - "context": { - "loc": { - "start": { - "line": 879, - "column": 2, - "index": 26544 - }, - "end": { - "line": 884, - "column": 3, - "index": 26729 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An array obtained by arranging the diagonal elements\nof the matrix in ascending order of index" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "diagonal", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "diagonal", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#diagonal" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is only for 3x3 matrices.\nTakes a vector and returns the vector resulting from multiplying to\nthat vector by this matrix from left." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "the vector to which this matrix applies", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "multVector" - }, - { - "title": "param", - "description": "The vector to receive the result", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - "name": "target" - }, - { - "title": "return", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "loc": { - "start": { - "line": 886, - "column": 2, - "index": 26733 - }, - "end": { - "line": 894, - "column": 3, - "index": 27058 - } - }, - "context": { - "loc": { - "start": { - "line": 895, - "column": 2, - "index": 27061 - }, - "end": { - "line": 903, - "column": 3, - "index": 27322 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "multVector", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the vector to which this matrix applies" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "target", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The vector to receive the result" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "multiplyVec3", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "multiplyVec3", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#multiplyVec3" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is only for 4x4 matrices.\nCreates a 3x3 matrix whose entries are the top left 3x3 part and returns it." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "p5.Matrix" - } - } - ], - "loc": { - "start": { - "line": 905, - "column": 2, - "index": 27326 - }, - "end": { - "line": 910, - "column": 3, - "index": 27482 - } - }, - "context": { - "loc": { - "start": { - "line": 911, - "column": 2, - "index": 27485 - }, - "end": { - "line": 923, - "column": 3, - "index": 27888 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Matrix" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createSubMatrix3x3", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createSubMatrix3x3", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#createSubMatrix3x3" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "return an identity matrix" - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "the result matrix", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Matrix" - } - } - ], - "loc": { - "start": { - "line": 134, - "column": 2, - "index": 3939 - }, - "end": { - "line": 137, - "column": 3, - "index": 4018 - } - }, - "context": { - "loc": { - "start": { - "line": 138, - "column": 2, - "index": 4021 - }, - "end": { - "line": 140, - "column": 3, - "index": 4081 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "pInst", - "lineNumber": 138 - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the result matrix" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Matrix" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "identity", - "kind": "function", - "memberof": "p5.Matrix", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "identity", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".identity" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use this method to make a new copy of a shader that gets compiled on a\ndifferent context." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The graphic or instance to copy this shader to.\nPass `window` if you need to copy to the main canvas.", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5" - }, - { - "type": "NameExpression", - "name": "p5.Graphics" - } - ] - }, - "name": "context" - }, - { - "title": "returns", - "description": "A new shader on the target context.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "p5.Shader" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 104, - "column": 2, - "index": 3322 - }, - "end": { - "line": 126, - "column": 5, - "index": 4195 - } - }, - "context": { - "loc": { - "start": { - "line": 127, - "column": 2, - "index": 4198 - }, - "end": { - "line": 135, - "column": 3, - "index": 4397 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Shader.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "context", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The graphic or instance to copy this shader to.\nPass " - }, - { - "type": "inlineCode", - "value": "window" - }, - { - "type": "text", - "value": " if you need to copy to the main canvas." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5" - }, - { - "type": "NameExpression", - "name": "p5.Graphics" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A new shader on the target context." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Shader" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "copyToContext", - "kind": "function", - "memberof": "p5.Shader", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "copyToContext", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#copyToContext" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Used to set the uniforms of a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Shader" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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)." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Here are some examples of uniforms you can make:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "booleans" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Example: " - }, - { - "type": "inlineCode", - "value": "setUniform('x', true)" - }, - { - "type": "text", - "value": " becomes " - }, - { - "type": "inlineCode", - "value": "uniform float x" - }, - { - "type": "text", - "value": " with the value " - }, - { - "type": "inlineCode", - "value": "1.0" - } - ] - } - ] - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "numbers" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Example: " - }, - { - "type": "inlineCode", - "value": "setUniform('x', -2)" - }, - { - "type": "text", - "value": " becomes " - }, - { - "type": "inlineCode", - "value": "uniform float x" - }, - { - "type": "text", - "value": " with the value " - }, - { - "type": "inlineCode", - "value": "-2.0" - } - ] - } - ] - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "arrays of numbers" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Example: " - }, - { - "type": "inlineCode", - "value": "setUniform('x', [0, 0.5, 1])" - }, - { - "type": "text", - "value": " becomes " - }, - { - "type": "inlineCode", - "value": "uniform vec3 x" - }, - { - "type": "text", - "value": " with the value " - }, - { - "type": "inlineCode", - "value": "vec3(0.0, 0.5, 1.0)" - } - ] - } - ] - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a p5.Image, p5.Graphics, p5.MediaElement, or p5.Texture" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Example: " - }, - { - "type": "inlineCode", - "value": "setUniform('x', img)" - }, - { - "type": "text", - "value": " becomes " - }, - { - "type": "inlineCode", - "value": "uniform sampler2D x" - } - ] - } - ] - } - ] - } - ] - } - ] - } - ] - }, - "tags": [ - { - "title": "chainable", - "description": null, - "lineNumber": 18 - }, - { - "title": "param", - "description": "the name of the uniform.\nMust correspond to the name used in the vertex and fragment shaders", - "lineNumber": 19, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "uniformName" - }, - { - "title": "param", - "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)", - "lineNumber": 21, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Boolean" - }, - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "p5.Image" - }, - { - "type": "NameExpression", - "name": "p5.Graphics" - }, - { - "type": "NameExpression", - "name": "p5.MediaElement" - }, - { - "type": "NameExpression", - "name": "p5.Texture" - } - ] - }, - "name": "data" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 26 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 76 - } - ], - "loc": { - "start": { - "line": 359, - "column": 2, - "index": 10585 - }, - "end": { - "line": 437, - "column": 5, - "index": 13628 - } - }, - "context": { - "loc": { - "start": { - "line": 438, - "column": 2, - "index": 13631 - }, - "end": { - "line": 550, - "column": 3, - "index": 16818 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Shader.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "uniformName", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the name of the uniform.\nMust correspond to the name used in the vertex and fragment shaders" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "data", - "lineNumber": 21, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Boolean" - }, - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "p5.Image" - }, - { - "type": "NameExpression", - "name": "p5.Graphics" - }, - { - "type": "NameExpression", - "name": "p5.MediaElement" - }, - { - "type": "NameExpression", - "name": "p5.Texture" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setUniform", - "kind": "function", - "memberof": "p5.Shader", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setUniform", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "#setUniform" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Conversions adapted from " - }, - { - "type": "link", - "title": null, - "url": "http://www.easyrgb.com/en/math.php", - "children": [ - { - "type": "text", - "value": "http://www.easyrgb.com/en/math.php" - } - ] - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "In these functions, hue is always in the range [0, 1], just like all other\ncomponents are in the range [0, 1]. 'Brightness' and 'value' are used\ninterchangeably." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 86 - }, - "end": { - "line": 14, - "column": 3, - "index": 333 - } - }, - "context": { - "loc": { - "start": { - "line": 16, - "column": 0, - "index": 335 - }, - "end": { - "line": 16, - "column": 30, - "index": 365 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/color_conversion.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "p5", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the number of frames drawn since the sketch started." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "frameCount" - }, - { - "type": "text", - "value": "'s value is 0 inside " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". It\nincrements by 1 each time the code in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfinishes executing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "frameCount" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 69, - "column": 0, - "index": 1553 - }, - "end": { - "line": 116, - "column": 3, - "index": 2581 - } - }, - "context": { - "loc": { - "start": { - "line": 117, - "column": 0, - "index": 2582 - }, - "end": { - "line": 117, - "column": 28, - "index": 2610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "frameCount", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "frameCount", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "frameCount", - "scope": "instance" - } - ], - "namespace": "p5#frameCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the amount of time, in milliseconds, it took for\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to draw the previous frame. " - }, - { - "type": "inlineCode", - "value": "deltaTime" - }, - { - "type": "text", - "value": " is\nuseful for simulating physics." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "deltaTime" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 2612 - }, - "end": { - "line": 161, - "column": 3, - "index": 3539 - } - }, - "context": { - "loc": { - "start": { - "line": 162, - "column": 0, - "index": 3540 - }, - "end": { - "line": 162, - "column": 27, - "index": 3567 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deltaTime", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deltaTime", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deltaTime", - "scope": "instance" - } - ], - "namespace": "p5#deltaTime" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks whether the browser window is focused and can receive user input.\n" - }, - { - "type": "inlineCode", - "value": "focused" - }, - { - "type": "text", - "value": " is " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": " if the window if focused and " - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "focused" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 164, - "column": 0, - "index": 3569 - }, - "end": { - "line": 190, - "column": 3, - "index": 4257 - } - }, - "context": { - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 4258 - }, - "end": { - "line": 191, - "column": 43, - "index": 4301 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "focused", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "focused", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "focused", - "scope": "instance" - } - ], - "namespace": "p5#focused" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A string variable with the WebGL version in use. Its value equals one of\nthe followin string constants:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL2" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl2'" - }, - { - "type": "text", - "value": "," - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl'" - }, - { - "type": "text", - "value": ", or" - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "P2D" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'p2d'" - }, - { - "type": "text", - "value": ". This is the default for 2D sketches." - } - ] - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setAttributes()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for ways to set the\nWebGL version." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - }, - "name": "webglVersion" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 12 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 466, - "column": 0, - "index": 12055 - }, - "end": { - "line": 544, - "column": 3, - "index": 13784 - } - }, - "context": { - "loc": { - "start": { - "line": 545, - "column": 0, - "index": 13785 - }, - "end": { - "line": 545, - "column": 34, - "index": 13819 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "webglVersion", - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "webglVersion", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "webglVersion", - "scope": "instance" - } - ], - "namespace": "p5#webglVersion" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayWidth" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen width can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayWidth * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 547, - "column": 0, - "index": 13821 - }, - "end": { - "line": 574, - "column": 3, - "index": 14559 - } - }, - "context": { - "loc": { - "start": { - "line": 575, - "column": 0, - "index": 14560 - }, - "end": { - "line": 575, - "column": 41, - "index": 14601 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayWidth", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayWidth", - "scope": "instance" - } - ], - "namespace": "p5#displayWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayHeight" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen height can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayHeight * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 577, - "column": 0, - "index": 14603 - }, - "end": { - "line": 604, - "column": 3, - "index": 15346 - } - }, - "context": { - "loc": { - "start": { - "line": 605, - "column": 0, - "index": 15347 - }, - "end": { - "line": 605, - "column": 43, - "index": 15390 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayHeight", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayHeight", - "scope": "instance" - } - ], - "namespace": "p5#displayHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 607, - "column": 0, - "index": 15392 - }, - "end": { - "line": 631, - "column": 3, - "index": 16081 - } - }, - "context": { - "loc": { - "start": { - "line": 632, - "column": 0, - "index": 16082 - }, - "end": { - "line": 632, - "column": 44, - "index": 16126 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowWidth", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowWidth", - "scope": "instance" - } - ], - "namespace": "p5#windowWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 634, - "column": 0, - "index": 16128 - }, - "end": { - "line": 658, - "column": 3, - "index": 16819 - } - }, - "context": { - "loc": { - "start": { - "line": 659, - "column": 0, - "index": 16820 - }, - "end": { - "line": 659, - "column": 46, - "index": 16866 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowHeight", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowHeight", - "scope": "instance" - } - ], - "namespace": "p5#windowHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "width" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "width" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 750, - "column": 0, - "index": 19217 - }, - "end": { - "line": 816, - "column": 3, - "index": 20713 - } - }, - "context": { - "loc": { - "start": { - "line": 817, - "column": 0, - "index": 20714 - }, - "end": { - "line": 817, - "column": 23, - "index": 20737 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "width", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "width", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "width", - "scope": "instance" - } - ], - "namespace": "p5#width" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "height" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "height" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 819, - "column": 0, - "index": 20739 - }, - "end": { - "line": 885, - "column": 3, - "index": 22246 - } - }, - "context": { - "loc": { - "start": { - "line": 886, - "column": 0, - "index": 22247 - }, - "end": { - "line": 886, - "column": 24, - "index": 22271 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "height", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "height", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "height", - "scope": "instance" - } - ], - "namespace": "p5#height" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "nothing displayed", - "lineNumber": 20 - } - ], - "loc": { - "start": { - "line": 317, - "column": 4, - "index": 10982 - }, - "end": { - "line": 340, - "column": 7, - "index": 11811 - } - }, - "context": { - "loc": { - "start": { - "line": 341, - "column": 4, - "index": 11816 - }, - "end": { - "line": 402, - "column": 6, - "index": 13726 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "remove", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "remove", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#remove" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function does 3 things:" - } - ] - }, - { - "type": "list", - "ordered": true, - "start": 1, - "spread": true, - "children": [ - { - "type": "listItem", - "spread": true, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Bounds the desired start/stop angles for an arc (in radians) so that:" - } - ] - }, - { - "type": "code", - "lang": null, - "meta": null, - "value": "0 <= start < TWO_PI ; start <= stop < start + TWO_PI" - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This means that the arc rendering functions don't have to be concerned\nwith what happens if stop is smaller than start, or if the arc 'goes\nround more than once', etc.: they can just start at start and increase\nuntil stop and the correct arc will be drawn." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Optionally adjusts the angles within each quadrant to counter the naive\nscaling of the underlying ellipse up from the unit circle. Without\nthis, the angles become arbitrary when width != height: 45 degrees\nmight be drawn at 5 degrees on a 'wide' ellipse, or at 85 degrees on\na 'tall' ellipse." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Flags up when start and stop correspond to the same place on the\nunderlying ellipse. This is useful if you want to do something special\nthere (like rendering a whole ellipse instead)." - } - ] - } - ] - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 16, - "column": 0, - "index": 333 - }, - "end": { - "line": 37, - "column": 3, - "index": 1365 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 1366 - }, - "end": { - "line": 100, - "column": 2, - "index": 3623 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "start", - "lineNumber": 39 - }, - { - "title": "param", - "name": "stop", - "lineNumber": 40 - }, - { - "title": "param", - "name": "width", - "lineNumber": 41 - }, - { - "title": "param", - "name": "height", - "lineNumber": 42 - }, - { - "title": "param", - "name": "correctForScaling", - "lineNumber": 43 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_normalizeArcAngles", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_normalizeArcAngles", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_normalizeArcAngles" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for select and selectAll" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 6392 - }, - "end": { - "line": 193, - "column": 3, - "index": 6443 - } - }, - "context": { - "loc": { - "start": { - "line": 194, - "column": 0, - "index": 6444 - }, - "end": { - "line": 204, - "column": 2, - "index": 6751 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "p", - "lineNumber": 194 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_getContainer", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_getContainer", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_getContainer" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for getElement and getElements." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 206, - "column": 0, - "index": 6753 - }, - "end": { - "line": 208, - "column": 3, - "index": 6811 - } - }, - "context": { - "loc": { - "start": { - "line": 209, - "column": 0, - "index": 6812 - }, - "end": { - "line": 238, - "column": 2, - "index": 7767 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "elt", - "lineNumber": 209 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_wrapElement", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_wrapElement", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_wrapElement" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "INPUT *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 715, - "column": 0, - "index": 21883 - }, - "end": { - "line": 715, - "column": 13, - "index": 21896 - } - }, - "context": { - "loc": { - "start": { - "line": 827, - "column": 0, - "index": 24953 - }, - "end": { - "line": 840, - "column": 2, - "index": 25384 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "min", - "lineNumber": 827 - }, - { - "title": "param", - "name": "max", - "lineNumber": 827 - }, - { - "title": "param", - "name": "value", - "lineNumber": 827 - }, - { - "title": "param", - "name": "step", - "lineNumber": 827 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createSlider", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createSlider", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createSlider" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "AUDIO STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2041, - "column": 0, - "index": 61417 - }, - "end": { - "line": 2041, - "column": 19, - "index": 61436 - } - }, - "context": { - "loc": { - "start": { - "line": 2080, - "column": 0, - "index": 62975 - }, - "end": { - "line": 2083, - "column": 2, - "index": 63135 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "src", - "lineNumber": 2080 - }, - { - "title": "param", - "name": "callback", - "lineNumber": 2080 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createAudio", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createAudio", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createAudio" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "CAMERA STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2085, - "column": 0, - "index": 63137 - }, - "end": { - "line": 2085, - "column": 20, - "index": 63157 - } - }, - "context": { - "loc": { - "start": { - "line": 2087, - "column": 0, - "index": 63159 - }, - "end": { - "line": 2087, - "column": 29, - "index": 63188 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "VIDEO", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "VIDEO", - "scope": "instance" - } - ], - "namespace": "p5#VIDEO" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - }, - "name": "deviceOrientation" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 20, - "column": 3, - "index": 511 - } - }, - "context": { - "loc": { - "start": { - "line": 21, - "column": 0, - "index": 512 - }, - "end": { - "line": 22, - "column": 74, - "index": 619 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deviceOrientation", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deviceOrientation", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deviceOrientation", - "scope": "instance" - } - ], - "namespace": "p5#deviceOrientation" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationX always contains the acceleration of the\ndevice along the x axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 24, - "column": 0, - "index": 621 - }, - "end": { - "line": 43, - "column": 3, - "index": 1167 - } - }, - "context": { - "loc": { - "start": { - "line": 44, - "column": 0, - "index": 1168 - }, - "end": { - "line": 44, - "column": 31, - "index": 1199 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationX", - "scope": "instance" - } - ], - "namespace": "p5#accelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationY always contains the acceleration of the\ndevice along the y axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 46, - "column": 0, - "index": 1201 - }, - "end": { - "line": 65, - "column": 3, - "index": 1746 - } - }, - "context": { - "loc": { - "start": { - "line": 66, - "column": 0, - "index": 1747 - }, - "end": { - "line": 66, - "column": 31, - "index": 1778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationY", - "scope": "instance" - } - ], - "namespace": "p5#accelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationZ always contains the acceleration of the\ndevice along the z axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 68, - "column": 0, - "index": 1780 - }, - "end": { - "line": 88, - "column": 3, - "index": 2328 - } - }, - "context": { - "loc": { - "start": { - "line": 89, - "column": 0, - "index": 2329 - }, - "end": { - "line": 89, - "column": 31, - "index": 2360 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationZ", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#accelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 91, - "column": 0, - "index": 2362 - }, - "end": { - "line": 98, - "column": 3, - "index": 2625 - } - }, - "context": { - "loc": { - "start": { - "line": 99, - "column": 0, - "index": 2626 - }, - "end": { - "line": 99, - "column": 32, - "index": 2658 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationX", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationX", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 101, - "column": 0, - "index": 2660 - }, - "end": { - "line": 108, - "column": 3, - "index": 2923 - } - }, - "context": { - "loc": { - "start": { - "line": 109, - "column": 0, - "index": 2924 - }, - "end": { - "line": 109, - "column": 32, - "index": 2956 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationY", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationY", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 111, - "column": 0, - "index": 2958 - }, - "end": { - "line": 118, - "column": 3, - "index": 3221 - } - }, - "context": { - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 3222 - }, - "end": { - "line": 119, - "column": 32, - "index": 3254 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationZ", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationX always contains the rotation of the\ndevice along the x axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES, the value will be -180 to 180. If\nit is set to RADIANS, the value will be -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 132, - "column": 0, - "index": 3568 - }, - "end": { - "line": 162, - "column": 3, - "index": 4447 - } - }, - "context": { - "loc": { - "start": { - "line": 163, - "column": 0, - "index": 4448 - }, - "end": { - "line": 163, - "column": 27, - "index": 4475 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationX", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationX", - "scope": "instance" - } - ], - "namespace": "p5#rotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationY always contains the rotation of the\ndevice along the y axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 165, - "column": 0, - "index": 4477 - }, - "end": { - "line": 195, - "column": 3, - "index": 5358 - } - }, - "context": { - "loc": { - "start": { - "line": 196, - "column": 0, - "index": 5359 - }, - "end": { - "line": 196, - "column": 27, - "index": 5386 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationY", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationY", - "scope": "instance" - } - ], - "namespace": "p5#rotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationZ always contains the rotation of the\ndevice along the z axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Unlike rotationX and rotationY, this variable is available for devices\nwith a built-in compass only." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - }, - { - "title": "property", - "description": null, - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 33 - } - ], - "loc": { - "start": { - "line": 198, - "column": 0, - "index": 5388 - }, - "end": { - "line": 232, - "column": 3, - "index": 6377 - } - }, - "context": { - "loc": { - "start": { - "line": 233, - "column": 0, - "index": 6378 - }, - "end": { - "line": 233, - "column": 27, - "index": 6405 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationZ", - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationZ", - "scope": "instance" - } - ], - "namespace": "p5#rotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES,\nthe value will be -180 to 180. If it is set to RADIANS, the value will\nbe -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationX can also be used with rotationX to determine the rotate\ndirection of the device along the X-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 40 - } - ], - "loc": { - "start": { - "line": 235, - "column": 0, - "index": 6407 - }, - "end": { - "line": 276, - "column": 3, - "index": 7745 - } - }, - "context": { - "loc": { - "start": { - "line": 277, - "column": 0, - "index": 7746 - }, - "end": { - "line": 277, - "column": 28, - "index": 7774 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationX", - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationX", - "scope": "instance" - } - ], - "namespace": "p5#pRotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationY can also be used with rotationY to determine the rotate\ndirection of the device along the Y-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 39 - } - ], - "loc": { - "start": { - "line": 279, - "column": 0, - "index": 7776 - }, - "end": { - "line": 319, - "column": 3, - "index": 9113 - } - }, - "context": { - "loc": { - "start": { - "line": 320, - "column": 0, - "index": 9114 - }, - "end": { - "line": 320, - "column": 28, - "index": 9142 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationY", - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationY", - "scope": "instance" - } - ], - "namespace": "p5#pRotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationZ can also be used with rotationZ to determine the rotate\ndirection of the device along the Z-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 35 - } - ], - "loc": { - "start": { - "line": 322, - "column": 0, - "index": 9144 - }, - "end": { - "line": 358, - "column": 3, - "index": 10350 - } - }, - "context": { - "loc": { - "start": { - "line": 359, - "column": 0, - "index": 10351 - }, - "end": { - "line": 359, - "column": 28, - "index": 10379 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationZ", - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationZ", - "scope": "instance" - } - ], - "namespace": "p5#pRotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When a device is rotated, the axis that triggers the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "deviceTurned()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nmethod is stored in the turnAxis variable. The turnAxis variable is only defined within\nthe scope of deviceTurned()." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "turnAxis" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 379, - "column": 0, - "index": 10890 - }, - "end": { - "line": 412, - "column": 3, - "index": 11826 - } - }, - "context": { - "loc": { - "start": { - "line": 413, - "column": 0, - "index": 11827 - }, - "end": { - "line": 413, - "column": 34, - "index": 11861 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "turnAxis", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "turnAxis", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "turnAxis", - "scope": "instance" - } - ], - "namespace": "p5#turnAxis" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyIsPressed" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is true if any key is pressed\nand false if no keys are pressed." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "keyIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 111 - }, - "end": { - "line": 30, - "column": 3, - "index": 575 - } - }, - "context": { - "loc": { - "start": { - "line": 31, - "column": 0, - "index": 576 - }, - "end": { - "line": 31, - "column": 34, - "index": 610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "isKeyPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "isKeyPressed", - "scope": "instance" - } - ], - "namespace": "p5#isKeyPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyTyped()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". For non-ASCII keys, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyCode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nvariable." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "key" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 34, - "column": 0, - "index": 655 - }, - "end": { - "line": 57, - "column": 3, - "index": 1373 - } - }, - "context": { - "loc": { - "start": { - "line": 58, - "column": 0, - "index": 1374 - }, - "end": { - "line": 58, - "column": 22, - "index": 1396 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "key", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "key", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "key", - "scope": "instance" - } - ], - "namespace": "p5#key" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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: " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keycode.info" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "keyCode" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 60, - "column": 0, - "index": 1398 - }, - "end": { - "line": 95, - "column": 3, - "index": 2425 - } - }, - "context": { - "loc": { - "start": { - "line": 96, - "column": 0, - "index": 2426 - }, - "end": { - "line": 96, - "column": 25, - "index": 2451 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyCode", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "keyCode", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "keyCode", - "scope": "instance" - } - ], - "namespace": "p5#keyCode" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The onblur function is called when the user is no longer focused\non the p5 element. Because the keyup events will not fire if the user is\nnot focused on the element we must assume all keys currently down have\nbeen released." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 291, - "column": 0, - "index": 8735 - }, - "end": { - "line": 296, - "column": 3, - "index": 8978 - } - }, - "context": { - "loc": { - "start": { - "line": 297, - "column": 0, - "index": 8979 - }, - "end": { - "line": 299, - "column": 2, - "index": 9041 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "e", - "lineNumber": 297 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_onblur", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_onblur", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_onblur" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedX contains the horizontal movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 4 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 40, - "column": 3, - "index": 777 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 778 - }, - "end": { - "line": 41, - "column": 24, - "index": 802 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedX", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedX", - "scope": "instance" - } - ], - "namespace": "p5#movedX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedY contains the vertical movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 43, - "column": 0, - "index": 804 - }, - "end": { - "line": 70, - "column": 3, - "index": 1394 - } - }, - "context": { - "loc": { - "start": { - "line": 71, - "column": 0, - "index": 1395 - }, - "end": { - "line": 71, - "column": 24, - "index": 1419 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedY", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedY", - "scope": "instance" - } - ], - "namespace": "p5#movedY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 80, - "column": 0, - "index": 1666 - }, - "end": { - "line": 101, - "column": 3, - "index": 2316 - } - }, - "context": { - "loc": { - "start": { - "line": 102, - "column": 0, - "index": 2317 - }, - "end": { - "line": 102, - "column": 24, - "index": 2341 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseX", - "scope": "instance" - } - ], - "namespace": "p5#mouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 2343 - }, - "end": { - "line": 125, - "column": 3, - "index": 2986 - } - }, - "context": { - "loc": { - "start": { - "line": 126, - "column": 0, - "index": 2987 - }, - "end": { - "line": 126, - "column": 24, - "index": 3011 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseY", - "scope": "instance" - } - ], - "namespace": "p5#mouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 128, - "column": 0, - "index": 3013 - }, - "end": { - "line": 156, - "column": 3, - "index": 3890 - } - }, - "context": { - "loc": { - "start": { - "line": 157, - "column": 0, - "index": 3891 - }, - "end": { - "line": 157, - "column": 25, - "index": 3916 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseX", - "scope": "instance" - } - ], - "namespace": "p5#pmouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 159, - "column": 0, - "index": 3918 - }, - "end": { - "line": 186, - "column": 3, - "index": 4745 - } - }, - "context": { - "loc": { - "start": { - "line": 187, - "column": 0, - "index": 4746 - }, - "end": { - "line": 187, - "column": 25, - "index": 4771 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseY", - "scope": "instance" - } - ], - "namespace": "p5#pmouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseX always contains the current horizontal\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 189, - "column": 0, - "index": 4773 - }, - "end": { - "line": 223, - "column": 3, - "index": 5653 - } - }, - "context": { - "loc": { - "start": { - "line": 224, - "column": 0, - "index": 5654 - }, - "end": { - "line": 224, - "column": 27, - "index": 5681 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseX", - "scope": "instance" - } - ], - "namespace": "p5#winMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseY always contains the current vertical\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 226, - "column": 0, - "index": 5683 - }, - "end": { - "line": 260, - "column": 3, - "index": 6560 - } - }, - "context": { - "loc": { - "start": { - "line": 261, - "column": 0, - "index": 6561 - }, - "end": { - "line": 261, - "column": 27, - "index": 6588 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseY", - "scope": "instance" - } - ], - "namespace": "p5#winMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 263, - "column": 0, - "index": 6590 - }, - "end": { - "line": 299, - "column": 3, - "index": 7675 - } - }, - "context": { - "loc": { - "start": { - "line": 300, - "column": 0, - "index": 7676 - }, - "end": { - "line": 300, - "column": 28, - "index": 7704 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseX", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseX", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 302, - "column": 0, - "index": 7706 - }, - "end": { - "line": 338, - "column": 3, - "index": 8785 - } - }, - "context": { - "loc": { - "start": { - "line": 339, - "column": 0, - "index": 8786 - }, - "end": { - "line": 339, - "column": 28, - "index": 8814 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseY", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseY", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - }, - "name": "mouseButton" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 341, - "column": 0, - "index": 8816 - }, - "end": { - "line": 375, - "column": 3, - "index": 9715 - } - }, - "context": { - "loc": { - "start": { - "line": 376, - "column": 0, - "index": 9716 - }, - "end": { - "line": 376, - "column": 29, - "index": 9745 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseButton", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseButton", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseButton", - "scope": "instance" - } - ], - "namespace": "p5#mouseButton" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable mouseIsPressed is true if the mouse is pressed\nand false if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "mouseIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 378, - "column": 0, - "index": 9747 - }, - "end": { - "line": 404, - "column": 3, - "index": 10289 - } - }, - "context": { - "loc": { - "start": { - "line": 405, - "column": 0, - "index": 10290 - }, - "end": { - "line": 405, - "column": 36, - "index": 10326 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseIsPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseIsPressed", - "scope": "instance" - } - ], - "namespace": "p5#mouseIsPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The touches[] array is not supported on Safari and IE on touch-based\ndesktops (laptops)." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - }, - "name": "touches" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 108 - }, - "end": { - "line": 37, - "column": 3, - "index": 883 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 884 - }, - "end": { - "line": 38, - "column": 26, - "index": 910 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/touch.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "touches", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "touches", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "touches", - "scope": "instance" - } - ], - "namespace": "p5#touches" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An array containing the color of each pixel on the canvas. Colors are\nstored as numbers representing red, green, blue, and alpha (RGBA) values.\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " is a one-dimensional array for performance reasons." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Each pixel occupies four elements in the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array, one for each RGBA\nvalue. For example, the pixel at coordinates (0, 0) stores its RGBA values\nat " - }, - { - "type": "inlineCode", - "value": "pixels[0]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[1]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[2]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[3]" - }, - { - "type": "text", - "value": ", respectively.\nThe next pixel at coordinates (1, 0) stores its RGBA values at " - }, - { - "type": "inlineCode", - "value": "pixels[4]" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "inlineCode", - "value": "pixels[5]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[6]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[7]" - }, - { - "type": "text", - "value": ". And so on. The " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array\nfor a 100×100 canvas has 100 × 100 × 4 = 40,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Some displays use several smaller pixels to set the color at a single\npoint. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function returns\nthe pixel density of the canvas. High density displays often have a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " of 2. On such a display, the\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array for a 100×100 canvas has 200 × 200 × 4 =\n160,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Accessing the RGBA values for a point on the canvas requires a little math\nas shown below. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadPixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function\nmust be called before accessing the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array. The\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "updatePixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function must be called\nafter any changes are made." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "pixels" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 169 - }, - "end": { - "line": 103, - "column": 3, - "index": 3031 - } - }, - "context": { - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 3032 - }, - "end": { - "line": 104, - "column": 25, - "index": 3057 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pixels", - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pixels", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pixels", - "scope": "instance" - } - ], - "namespace": "p5#pixels" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function to measure ascent and descent." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 362, - "column": 0, - "index": 9474 - }, - "end": { - "line": 364, - "column": 3, - "index": 9531 - } - }, - "context": { - "loc": { - "start": { - "line": 365, - "column": 0, - "index": 9532 - }, - "end": { - "line": 367, - "column": 2, - "index": 9627 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_updateTextMetrics", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_updateTextMetrics", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_updateTextMetrics" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ensures that p5 is using a 3d renderer. throws an error if not." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2350, - "column": 0, - "index": 73393 - }, - "end": { - "line": 2352, - "column": 3, - "index": 73467 - } - }, - "context": { - "loc": { - "start": { - "line": 2353, - "column": 0, - "index": 73468 - }, - "end": { - "line": 2358, - "column": 2, - "index": 73742 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "name", - "lineNumber": 2353 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_assert3d", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_assert3d", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_assert3d" - } - ], - "events": [], - "static": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Turn off some features of the friendly error system (FES), which can give\na significant boost to performance when needed." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ndisabling the friendly error system" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "disableFriendlyErrors" - }, - { - "title": "example", - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 754, - "column": 0, - "index": 26038 - }, - "end": { - "line": 776, - "column": 3, - "index": 26889 - } - }, - "context": { - "loc": { - "start": { - "line": 777, - "column": 0, - "index": 26890 - }, - "end": { - "line": 777, - "column": 33, - "index": 26923 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "disableFriendlyErrors", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "disableFriendlyErrors", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "disableFriendlyErrors", - "scope": "static" - } - ], - "namespace": "p5.disableFriendlyErrors" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Path to the media element's source as a string." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.MediaElement", - "lineNumber": 3 - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "src" - }, - { - "title": "return", - "description": "src", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 4842, - "column": 0, - "index": 139686 - }, - "end": { - "line": 4868, - "column": 3, - "index": 140231 - } - }, - "context": { - "loc": { - "start": { - "line": 4958, - "column": 0, - "index": 142394 - }, - "end": { - "line": 5009, - "column": 2, - "index": 143967 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "src" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "File", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "File", - "scope": "static" - } - ], - "namespace": "p5.File" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Table Options\nGeneric class for handling tabular data, typically from a\nCSV, TSV, or other sort of spreadsheet file.\nCSV files are\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ncomma separated values" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", often with the data in quotes. TSV\nfiles use tabs as separators, and usually don't bother with the\nquotes.\nFile names should end with .csv if they're comma separated.\nA rough \"spec\" for CSV can be found\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "here" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nTo load files, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method.\nTo save tables to your computer, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "save" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method\nor the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "saveTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Possible options include:" - } - ] - }, - { - "type": "html", - "value": "
    \n
  • csv - parse the table as comma-separated values\n
  • tsv - parse the table as tab-separated values\n
  • header - this table has a header (title) row\n
" - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 93 - }, - "end": { - "line": 31, - "column": 3, - "index": 1053 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 1379 - }, - "end": { - "line": 1259, - "column": 2, - "index": 33791 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "Table", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addRow()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new row of data to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "set()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object is included as a parameter, then that row is\nduplicated and added to the table." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row to be added to the table", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - "name": "row" - }, - { - "title": "return", - "description": "the row that was added", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 47, - "column": 2, - "index": 1476 - }, - "end": { - "line": 94, - "column": 3, - "index": 2995 - } - }, - "context": { - "loc": { - "start": { - "line": 95, - "column": 2, - "index": 2998 - }, - "end": { - "line": 106, - "column": 3, - "index": 3319 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row to be added to the table" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the row that was added" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes a row from the table object." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to remove", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "id" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 108, - "column": 2, - "index": 3323 - }, - "end": { - "line": 145, - "column": 3, - "index": 4202 - } - }, - "context": { - "loc": { - "start": { - "line": 146, - "column": 2, - "index": 4205 - }, - "end": { - "line": 151, - "column": 3, - "index": 4410 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "id", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to remove" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a reference to the specified " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". The reference\ncan then be used to get and set values of the selected row." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to get", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "rowID" - }, - { - "title": "return", - "description": "p5.TableRow object", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 153, - "column": 2, - "index": 4414 - }, - "end": { - "line": 191, - "column": 3, - "index": 5463 - } - }, - "context": { - "loc": { - "start": { - "line": 192, - "column": 2, - "index": 5466 - }, - "end": { - "line": 194, - "column": 3, - "index": 5507 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "r", - "lineNumber": 192 - }, - { - "title": "param", - "name": "rowID", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to get" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Gets all rows from the table. Returns an array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Array of p5.TableRows", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 196, - "column": 2, - "index": 5511 - }, - "end": { - "line": 237, - "column": 3, - "index": 6588 - } - }, - "context": { - "loc": { - "start": { - "line": 238, - "column": 2, - "index": 6591 - }, - "end": { - "line": 240, - "column": 3, - "index": 6629 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 242, - "column": 2, - "index": 6633 - }, - "end": { - "line": 282, - "column": 3, - "index": 7805 - } - }, - "context": { - "loc": { - "start": { - "line": 283, - "column": 2, - "index": 7808 - }, - "end": { - "line": 301, - "column": 3, - "index": 8272 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 10, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 303, - "column": 2, - "index": 8276 - }, - "end": { - "line": 348, - "column": 3, - "index": 9683 - } - }, - "context": { - "loc": { - "start": { - "line": 349, - "column": 2, - "index": 9686 - }, - "end": { - "line": 366, - "column": 3, - "index": 10136 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "TableRow object", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 368, - "column": 2, - "index": 10140 - }, - "end": { - "line": 407, - "column": 3, - "index": 11362 - } - }, - "context": { - "loc": { - "start": { - "line": 408, - "column": 2, - "index": 11365 - }, - "end": { - "line": 423, - "column": 3, - "index": 11778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "TableRow object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 425, - "column": 2, - "index": 11782 - }, - "end": { - "line": 472, - "column": 3, - "index": 13226 - } - }, - "context": { - "loc": { - "start": { - "line": 473, - "column": 2, - "index": 13229 - }, - "end": { - "line": 489, - "column": 3, - "index": 13668 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all values in the specified column, and returns them\nas an array. The column may be specified by either its ID or title." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String or Number of the column to return", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "Array of column values", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 491, - "column": 2, - "index": 13672 - }, - "end": { - "line": 525, - "column": 3, - "index": 14658 - } - }, - "context": { - "loc": { - "start": { - "line": 526, - "column": 2, - "index": 14661 - }, - "end": { - "line": 538, - "column": 3, - "index": 14980 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 526 - }, - { - "title": "param", - "name": "column", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String or Number of the column to return" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of column values" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes all rows from a Table. While all rows are removed,\ncolumns and column titles are maintained." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 540, - "column": 2, - "index": 14984 - }, - "end": { - "line": 571, - "column": 3, - "index": 15789 - } - }, - "context": { - "loc": { - "start": { - "line": 572, - "column": 2, - "index": 15792 - }, - "end": { - "line": 575, - "column": 3, - "index": 15852 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clearRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "clearRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#clearRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new column to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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.)" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "title of the given column", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "title" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 577, - "column": 2, - "index": 15856 - }, - "end": { - "line": 619, - "column": 3, - "index": 17079 - } - }, - "context": { - "loc": { - "start": { - "line": 620, - "column": 2, - "index": 17082 - }, - "end": { - "line": 623, - "column": 3, - "index": 17160 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "title", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "title of the given column" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of columns in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of columns in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 625, - "column": 2, - "index": 17164 - }, - "end": { - "line": 655, - "column": 3, - "index": 17854 - } - }, - "context": { - "loc": { - "start": { - "line": 656, - "column": 2, - "index": 17857 - }, - "end": { - "line": 658, - "column": 3, - "index": 17912 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of columns in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumnCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumnCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumnCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of rows in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of rows in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 660, - "column": 2, - "index": 17916 - }, - "end": { - "line": 690, - "column": 3, - "index": 18564 - } - }, - "context": { - "loc": { - "start": { - "line": 691, - "column": 2, - "index": 18567 - }, - "end": { - "line": 693, - "column": 3, - "index": 18616 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of rows in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRowCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRowCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRowCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes any of the specified characters (or \"tokens\")." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String listing characters to be removed", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "chars" - }, - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 695, - "column": 2, - "index": 18620 - }, - "end": { - "line": 730, - "column": 3, - "index": 19601 - } - }, - "context": { - "loc": { - "start": { - "line": 731, - "column": 2, - "index": 19604 - }, - "end": { - "line": 764, - "column": 3, - "index": 20779 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "chars", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String listing characters to be removed" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeTokens", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeTokens", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeTokens" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 766, - "column": 2, - "index": 20783 - }, - "end": { - "line": 798, - "column": 3, - "index": 21711 - } - }, - "context": { - "loc": { - "start": { - "line": 799, - "column": 2, - "index": 21714 - }, - "end": { - "line": 827, - "column": 3, - "index": 22666 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "trim", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "trim", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#trim" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "removeColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "columnName (string) or ID (number)", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 829, - "column": 2, - "index": 22670 - }, - "end": { - "line": 864, - "column": 3, - "index": 23691 - } - }, - "context": { - "loc": { - "start": { - "line": 865, - "column": 2, - "index": 23694 - }, - "end": { - "line": 888, - "column": 3, - "index": 24362 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "c", - "lineNumber": 865 - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or ID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 890, - "column": 2, - "index": 24366 - }, - "end": { - "line": 932, - "column": 3, - "index": 25518 - } - }, - "context": { - "loc": { - "start": { - "line": 933, - "column": 2, - "index": 25521 - }, - "end": { - "line": 935, - "column": 3, - "index": 25590 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "set", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "set", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#set" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 937, - "column": 2, - "index": 25594 - }, - "end": { - "line": 976, - "column": 3, - "index": 26578 - } - }, - "context": { - "loc": { - "start": { - "line": 977, - "column": 2, - "index": 26581 - }, - "end": { - "line": 979, - "column": 3, - "index": 26656 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 981, - "column": 2, - "index": 26660 - }, - "end": { - "line": 1019, - "column": 3, - "index": 27767 - } - }, - "context": { - "loc": { - "start": { - "line": 1020, - "column": 2, - "index": 27770 - }, - "end": { - "line": 1022, - "column": 3, - "index": 27851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1024, - "column": 2, - "index": 27855 - }, - "end": { - "line": 1062, - "column": 3, - "index": 28842 - } - }, - "context": { - "loc": { - "start": { - "line": 1063, - "column": 2, - "index": 28845 - }, - "end": { - "line": 1065, - "column": 3, - "index": 28907 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "get", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "get", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#get" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1067, - "column": 2, - "index": 28911 - }, - "end": { - "line": 1103, - "column": 3, - "index": 29853 - } - }, - "context": { - "loc": { - "start": { - "line": 1104, - "column": 2, - "index": 29856 - }, - "end": { - "line": 1106, - "column": 3, - "index": 29924 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1108, - "column": 2, - "index": 29928 - }, - "end": { - "line": 1151, - "column": 3, - "index": 31214 - } - }, - "context": { - "loc": { - "start": { - "line": 1153, - "column": 2, - "index": 31218 - }, - "end": { - "line": 1155, - "column": 3, - "index": 31292 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Name of the column which should be used to\n title each row object (optional)", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "headerColumn" - }, - { - "title": "return", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 1157, - "column": 2, - "index": 31296 - }, - "end": { - "line": 1195, - "column": 3, - "index": 32265 - } - }, - "context": { - "loc": { - "start": { - "line": 1196, - "column": 2, - "index": 32268 - }, - "end": { - "line": 1216, - "column": 3, - "index": 32851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "headerColumn", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Name of the column which should be used to\ntitle each row object (optional)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getObject", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getObject", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getObject" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all table data and returns it as a multidimensional array." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 1218, - "column": 2, - "index": 32855 - }, - "end": { - "line": 1251, - "column": 3, - "index": 33622 - } - }, - "context": { - "loc": { - "start": { - "line": 1252, - "column": 2, - "index": 33625 - }, - "end": { - "line": 1258, - "column": 3, - "index": 33788 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getArray", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getArray" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - } - ], - "namespace": "p5.Table" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An internal class to store data that will be sent to a p5.RenderBuffer.\nThose need to eventually go into a Float32Array, so this class provides a\nvariable-length array container backed by a Float32Array so that it can be\nsent to the GPU without allocating a new array each frame." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Like a C++ vector, its fixed-length Float32Array backing its contents will\ndouble in size when it goes over its capacity." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 3, - "column": 0, - "index": 32 - }, - "end": { - "line": 27, - "column": 3, - "index": 926 - } - }, - "context": { - "loc": { - "start": { - "line": 28, - "column": 0, - "index": 927 - }, - "end": { - "line": 108, - "column": 2, - "index": 2998 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "DataArray", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a Float32Array window sized to the exact length of the data" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 35, - "column": 2, - "index": 1114 - }, - "end": { - "line": 37, - "column": 5, - "index": 1196 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 2, - "index": 1199 - }, - "end": { - "line": 40, - "column": 3, - "index": 1258 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dataArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "dataArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#dataArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A \"soft\" clear, which keeps the underlying storage size the same, but\nempties the contents of its dataArray()" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 42, - "column": 2, - "index": 1262 - }, - "end": { - "line": 45, - "column": 5, - "index": 1391 - } - }, - "context": { - "loc": { - "start": { - "line": 46, - "column": 2, - "index": 1394 - }, - "end": { - "line": 48, - "column": 3, - "index": 1428 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clear", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "clear", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#clear" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Can be used to scale a DataArray back down to fit its contents." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 50, - "column": 2, - "index": 1432 - }, - "end": { - "line": 52, - "column": 5, - "index": 1510 - } - }, - "context": { - "loc": { - "start": { - "line": 53, - "column": 2, - "index": 1513 - }, - "end": { - "line": 61, - "column": 3, - "index": 1839 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rescale", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "rescale", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#rescale" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A full reset, which allocates a new underlying Float32Array at its initial\nlength" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 63, - "column": 2, - "index": 1843 - }, - "end": { - "line": 66, - "column": 5, - "index": 1944 - } - }, - "context": { - "loc": { - "start": { - "line": 67, - "column": 2, - "index": 1947 - }, - "end": { - "line": 70, - "column": 3, - "index": 2032 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "reset", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "reset", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#reset" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Adds values to the DataArray, expanding its internal storage to\naccommodate the new items." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 72, - "column": 2, - "index": 2036 - }, - "end": { - "line": 75, - "column": 5, - "index": 2146 - } - }, - "context": { - "loc": { - "start": { - "line": 76, - "column": 2, - "index": 2149 - }, - "end": { - "line": 80, - "column": 3, - "index": 2296 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "values", - "lineNumber": 76, - "type": { - "type": "RestType" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "push", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "push", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#push" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a copy of the data from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to the index\n" - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 82, - "column": 2, - "index": 2300 - }, - "end": { - "line": 85, - "column": 5, - "index": 2409 - } - }, - "context": { - "loc": { - "start": { - "line": 86, - "column": 2, - "index": 2412 - }, - "end": { - "line": 88, - "column": 3, - "index": 2494 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 86 - }, - { - "title": "param", - "name": "to", - "lineNumber": 86 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "slice", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "slice", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#slice" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a mutable Float32Array window from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to\nthe index " - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 90, - "column": 2, - "index": 2498 - }, - "end": { - "line": 93, - "column": 5, - "index": 2618 - } - }, - "context": { - "loc": { - "start": { - "line": 94, - "column": 2, - "index": 2621 - }, - "end": { - "line": 96, - "column": 3, - "index": 2709 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 94 - }, - { - "title": "param", - "name": "to", - "lineNumber": 94 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "subArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "subArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#subArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Expand capacity of the internal storage until it can fit a target size" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 98, - "column": 2, - "index": 2713 - }, - "end": { - "line": 100, - "column": 5, - "index": 2798 - } - }, - "context": { - "loc": { - "start": { - "line": 101, - "column": 2, - "index": 2801 - }, - "end": { - "line": 107, - "column": 3, - "index": 2995 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "target", - "lineNumber": 101 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "ensureLength", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "ensureLength", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#ensureLength" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - } - ], - "namespace": "p5.DataArray" - } - ] - }, - "path": [ - { - "name": "p5" - } - ], - "namespace": "p5" - }, - { - "description": "", - "tags": [ - { - "title": "for", - "description": "p5", - "lineNumber": 1 - }, - { - "title": "requires", - "description": null, - "lineNumber": 2, - "name": "core", - "errors": [ - "Unknown content 'This is the main file for the Friendly Error System (FES), containing\nthe core as well as miscellaneous functionality of the FES. Here is a\nbrief outline of the functions called in this system.\n\nThe FES may be invoked by a call to either\n(1) _validateParameters, (2) _friendlyFileLoadError, (3) _friendlyError,\n(4) helpForMisusedAtTopLevelCode, or (5) _fesErrorMonitor.\n\n_validateParameters is located in validate_params.js along with other code\nused for parameter validation.\n_friendlyFileLoadError is located in file_errors.js along with other code\nused for dealing with file load errors.\nApart from this, there's also a file stacktrace.js, which contains the code\nto parse the error stack, borrowed from:\nhttps://github.com/stacktracejs/stacktrace.js\n\nFor more detailed information on the FES functions, including the call\nsequence of each function, please look at the FES Reference + Dev Notes:\nhttps://github.com/processing/p5.js/blob/main/contributor_docs/fes_reference_dev_notes.md'" - ] - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 24, - "column": 3, - "index": 1082 - } - }, - "context": { - "loc": { - "start": { - "line": 25, - "column": 0, - "index": 1083 - }, - "end": { - "line": 25, - "column": 25, - "index": 1108 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/friendly_errors/fes_core.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "p5", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the number of frames drawn since the sketch started." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "frameCount" - }, - { - "type": "text", - "value": "'s value is 0 inside " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". It\nincrements by 1 each time the code in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfinishes executing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "frameCount" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 69, - "column": 0, - "index": 1553 - }, - "end": { - "line": 116, - "column": 3, - "index": 2581 - } - }, - "context": { - "loc": { - "start": { - "line": 117, - "column": 0, - "index": 2582 - }, - "end": { - "line": 117, - "column": 28, - "index": 2610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "frameCount", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "frameCount", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "frameCount", - "scope": "instance" - } - ], - "namespace": "p5#frameCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the amount of time, in milliseconds, it took for\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to draw the previous frame. " - }, - { - "type": "inlineCode", - "value": "deltaTime" - }, - { - "type": "text", - "value": " is\nuseful for simulating physics." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "deltaTime" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 2612 - }, - "end": { - "line": 161, - "column": 3, - "index": 3539 - } - }, - "context": { - "loc": { - "start": { - "line": 162, - "column": 0, - "index": 3540 - }, - "end": { - "line": 162, - "column": 27, - "index": 3567 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deltaTime", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deltaTime", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deltaTime", - "scope": "instance" - } - ], - "namespace": "p5#deltaTime" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks whether the browser window is focused and can receive user input.\n" - }, - { - "type": "inlineCode", - "value": "focused" - }, - { - "type": "text", - "value": " is " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": " if the window if focused and " - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "focused" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 164, - "column": 0, - "index": 3569 - }, - "end": { - "line": 190, - "column": 3, - "index": 4257 - } - }, - "context": { - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 4258 - }, - "end": { - "line": 191, - "column": 43, - "index": 4301 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "focused", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "focused", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "focused", - "scope": "instance" - } - ], - "namespace": "p5#focused" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A string variable with the WebGL version in use. Its value equals one of\nthe followin string constants:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL2" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl2'" - }, - { - "type": "text", - "value": "," - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl'" - }, - { - "type": "text", - "value": ", or" - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "P2D" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'p2d'" - }, - { - "type": "text", - "value": ". This is the default for 2D sketches." - } - ] - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setAttributes()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for ways to set the\nWebGL version." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - }, - "name": "webglVersion" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 12 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 466, - "column": 0, - "index": 12055 - }, - "end": { - "line": 544, - "column": 3, - "index": 13784 - } - }, - "context": { - "loc": { - "start": { - "line": 545, - "column": 0, - "index": 13785 - }, - "end": { - "line": 545, - "column": 34, - "index": 13819 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "webglVersion", - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "webglVersion", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "webglVersion", - "scope": "instance" - } - ], - "namespace": "p5#webglVersion" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayWidth" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen width can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayWidth * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 547, - "column": 0, - "index": 13821 - }, - "end": { - "line": 574, - "column": 3, - "index": 14559 - } - }, - "context": { - "loc": { - "start": { - "line": 575, - "column": 0, - "index": 14560 - }, - "end": { - "line": 575, - "column": 41, - "index": 14601 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayWidth", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayWidth", - "scope": "instance" - } - ], - "namespace": "p5#displayWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayHeight" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen height can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayHeight * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 577, - "column": 0, - "index": 14603 - }, - "end": { - "line": 604, - "column": 3, - "index": 15346 - } - }, - "context": { - "loc": { - "start": { - "line": 605, - "column": 0, - "index": 15347 - }, - "end": { - "line": 605, - "column": 43, - "index": 15390 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayHeight", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayHeight", - "scope": "instance" - } - ], - "namespace": "p5#displayHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 607, - "column": 0, - "index": 15392 - }, - "end": { - "line": 631, - "column": 3, - "index": 16081 - } - }, - "context": { - "loc": { - "start": { - "line": 632, - "column": 0, - "index": 16082 - }, - "end": { - "line": 632, - "column": 44, - "index": 16126 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowWidth", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowWidth", - "scope": "instance" - } - ], - "namespace": "p5#windowWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 634, - "column": 0, - "index": 16128 - }, - "end": { - "line": 658, - "column": 3, - "index": 16819 - } - }, - "context": { - "loc": { - "start": { - "line": 659, - "column": 0, - "index": 16820 - }, - "end": { - "line": 659, - "column": 46, - "index": 16866 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowHeight", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowHeight", - "scope": "instance" - } - ], - "namespace": "p5#windowHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "width" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "width" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 750, - "column": 0, - "index": 19217 - }, - "end": { - "line": 816, - "column": 3, - "index": 20713 - } - }, - "context": { - "loc": { - "start": { - "line": 817, - "column": 0, - "index": 20714 - }, - "end": { - "line": 817, - "column": 23, - "index": 20737 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "width", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "width", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "width", - "scope": "instance" - } - ], - "namespace": "p5#width" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "height" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "height" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 819, - "column": 0, - "index": 20739 - }, - "end": { - "line": 885, - "column": 3, - "index": 22246 - } - }, - "context": { - "loc": { - "start": { - "line": 886, - "column": 0, - "index": 22247 - }, - "end": { - "line": 886, - "column": 24, - "index": 22271 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "height", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "height", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "height", - "scope": "instance" - } - ], - "namespace": "p5#height" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "nothing displayed", - "lineNumber": 20 - } - ], - "loc": { - "start": { - "line": 317, - "column": 4, - "index": 10982 - }, - "end": { - "line": 340, - "column": 7, - "index": 11811 - } - }, - "context": { - "loc": { - "start": { - "line": 341, - "column": 4, - "index": 11816 - }, - "end": { - "line": 402, - "column": 6, - "index": 13726 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "remove", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "remove", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#remove" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function does 3 things:" - } - ] - }, - { - "type": "list", - "ordered": true, - "start": 1, - "spread": true, - "children": [ - { - "type": "listItem", - "spread": true, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Bounds the desired start/stop angles for an arc (in radians) so that:" - } - ] - }, - { - "type": "code", - "lang": null, - "meta": null, - "value": "0 <= start < TWO_PI ; start <= stop < start + TWO_PI" - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This means that the arc rendering functions don't have to be concerned\nwith what happens if stop is smaller than start, or if the arc 'goes\nround more than once', etc.: they can just start at start and increase\nuntil stop and the correct arc will be drawn." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Optionally adjusts the angles within each quadrant to counter the naive\nscaling of the underlying ellipse up from the unit circle. Without\nthis, the angles become arbitrary when width != height: 45 degrees\nmight be drawn at 5 degrees on a 'wide' ellipse, or at 85 degrees on\na 'tall' ellipse." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Flags up when start and stop correspond to the same place on the\nunderlying ellipse. This is useful if you want to do something special\nthere (like rendering a whole ellipse instead)." - } - ] - } - ] - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 16, - "column": 0, - "index": 333 - }, - "end": { - "line": 37, - "column": 3, - "index": 1365 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 1366 - }, - "end": { - "line": 100, - "column": 2, - "index": 3623 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "start", - "lineNumber": 39 - }, - { - "title": "param", - "name": "stop", - "lineNumber": 40 - }, - { - "title": "param", - "name": "width", - "lineNumber": 41 - }, - { - "title": "param", - "name": "height", - "lineNumber": 42 - }, - { - "title": "param", - "name": "correctForScaling", - "lineNumber": 43 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_normalizeArcAngles", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_normalizeArcAngles", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_normalizeArcAngles" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for select and selectAll" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 6392 - }, - "end": { - "line": 193, - "column": 3, - "index": 6443 - } - }, - "context": { - "loc": { - "start": { - "line": 194, - "column": 0, - "index": 6444 - }, - "end": { - "line": 204, - "column": 2, - "index": 6751 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "p", - "lineNumber": 194 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_getContainer", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_getContainer", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_getContainer" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for getElement and getElements." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 206, - "column": 0, - "index": 6753 - }, - "end": { - "line": 208, - "column": 3, - "index": 6811 - } - }, - "context": { - "loc": { - "start": { - "line": 209, - "column": 0, - "index": 6812 - }, - "end": { - "line": 238, - "column": 2, - "index": 7767 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "elt", - "lineNumber": 209 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_wrapElement", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_wrapElement", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_wrapElement" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "INPUT *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 715, - "column": 0, - "index": 21883 - }, - "end": { - "line": 715, - "column": 13, - "index": 21896 - } - }, - "context": { - "loc": { - "start": { - "line": 827, - "column": 0, - "index": 24953 - }, - "end": { - "line": 840, - "column": 2, - "index": 25384 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "min", - "lineNumber": 827 - }, - { - "title": "param", - "name": "max", - "lineNumber": 827 - }, - { - "title": "param", - "name": "value", - "lineNumber": 827 - }, - { - "title": "param", - "name": "step", - "lineNumber": 827 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createSlider", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createSlider", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createSlider" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "AUDIO STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2041, - "column": 0, - "index": 61417 - }, - "end": { - "line": 2041, - "column": 19, - "index": 61436 - } - }, - "context": { - "loc": { - "start": { - "line": 2080, - "column": 0, - "index": 62975 - }, - "end": { - "line": 2083, - "column": 2, - "index": 63135 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "src", - "lineNumber": 2080 - }, - { - "title": "param", - "name": "callback", - "lineNumber": 2080 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createAudio", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createAudio", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createAudio" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "CAMERA STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2085, - "column": 0, - "index": 63137 - }, - "end": { - "line": 2085, - "column": 20, - "index": 63157 - } - }, - "context": { - "loc": { - "start": { - "line": 2087, - "column": 0, - "index": 63159 - }, - "end": { - "line": 2087, - "column": 29, - "index": 63188 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "VIDEO", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "VIDEO", - "scope": "instance" - } - ], - "namespace": "p5#VIDEO" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - }, - "name": "deviceOrientation" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 20, - "column": 3, - "index": 511 - } - }, - "context": { - "loc": { - "start": { - "line": 21, - "column": 0, - "index": 512 - }, - "end": { - "line": 22, - "column": 74, - "index": 619 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deviceOrientation", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deviceOrientation", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deviceOrientation", - "scope": "instance" - } - ], - "namespace": "p5#deviceOrientation" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationX always contains the acceleration of the\ndevice along the x axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 24, - "column": 0, - "index": 621 - }, - "end": { - "line": 43, - "column": 3, - "index": 1167 - } - }, - "context": { - "loc": { - "start": { - "line": 44, - "column": 0, - "index": 1168 - }, - "end": { - "line": 44, - "column": 31, - "index": 1199 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationX", - "scope": "instance" - } - ], - "namespace": "p5#accelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationY always contains the acceleration of the\ndevice along the y axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 46, - "column": 0, - "index": 1201 - }, - "end": { - "line": 65, - "column": 3, - "index": 1746 - } - }, - "context": { - "loc": { - "start": { - "line": 66, - "column": 0, - "index": 1747 - }, - "end": { - "line": 66, - "column": 31, - "index": 1778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationY", - "scope": "instance" - } - ], - "namespace": "p5#accelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationZ always contains the acceleration of the\ndevice along the z axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 68, - "column": 0, - "index": 1780 - }, - "end": { - "line": 88, - "column": 3, - "index": 2328 - } - }, - "context": { - "loc": { - "start": { - "line": 89, - "column": 0, - "index": 2329 - }, - "end": { - "line": 89, - "column": 31, - "index": 2360 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationZ", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#accelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 91, - "column": 0, - "index": 2362 - }, - "end": { - "line": 98, - "column": 3, - "index": 2625 - } - }, - "context": { - "loc": { - "start": { - "line": 99, - "column": 0, - "index": 2626 - }, - "end": { - "line": 99, - "column": 32, - "index": 2658 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationX", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationX", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 101, - "column": 0, - "index": 2660 - }, - "end": { - "line": 108, - "column": 3, - "index": 2923 - } - }, - "context": { - "loc": { - "start": { - "line": 109, - "column": 0, - "index": 2924 - }, - "end": { - "line": 109, - "column": 32, - "index": 2956 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationY", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationY", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 111, - "column": 0, - "index": 2958 - }, - "end": { - "line": 118, - "column": 3, - "index": 3221 - } - }, - "context": { - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 3222 - }, - "end": { - "line": 119, - "column": 32, - "index": 3254 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationZ", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationX always contains the rotation of the\ndevice along the x axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES, the value will be -180 to 180. If\nit is set to RADIANS, the value will be -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 132, - "column": 0, - "index": 3568 - }, - "end": { - "line": 162, - "column": 3, - "index": 4447 - } - }, - "context": { - "loc": { - "start": { - "line": 163, - "column": 0, - "index": 4448 - }, - "end": { - "line": 163, - "column": 27, - "index": 4475 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationX", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationX", - "scope": "instance" - } - ], - "namespace": "p5#rotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationY always contains the rotation of the\ndevice along the y axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 165, - "column": 0, - "index": 4477 - }, - "end": { - "line": 195, - "column": 3, - "index": 5358 - } - }, - "context": { - "loc": { - "start": { - "line": 196, - "column": 0, - "index": 5359 - }, - "end": { - "line": 196, - "column": 27, - "index": 5386 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationY", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationY", - "scope": "instance" - } - ], - "namespace": "p5#rotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationZ always contains the rotation of the\ndevice along the z axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Unlike rotationX and rotationY, this variable is available for devices\nwith a built-in compass only." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - }, - { - "title": "property", - "description": null, - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 33 - } - ], - "loc": { - "start": { - "line": 198, - "column": 0, - "index": 5388 - }, - "end": { - "line": 232, - "column": 3, - "index": 6377 - } - }, - "context": { - "loc": { - "start": { - "line": 233, - "column": 0, - "index": 6378 - }, - "end": { - "line": 233, - "column": 27, - "index": 6405 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationZ", - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationZ", - "scope": "instance" - } - ], - "namespace": "p5#rotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES,\nthe value will be -180 to 180. If it is set to RADIANS, the value will\nbe -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationX can also be used with rotationX to determine the rotate\ndirection of the device along the X-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 40 - } - ], - "loc": { - "start": { - "line": 235, - "column": 0, - "index": 6407 - }, - "end": { - "line": 276, - "column": 3, - "index": 7745 - } - }, - "context": { - "loc": { - "start": { - "line": 277, - "column": 0, - "index": 7746 - }, - "end": { - "line": 277, - "column": 28, - "index": 7774 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationX", - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationX", - "scope": "instance" - } - ], - "namespace": "p5#pRotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationY can also be used with rotationY to determine the rotate\ndirection of the device along the Y-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 39 - } - ], - "loc": { - "start": { - "line": 279, - "column": 0, - "index": 7776 - }, - "end": { - "line": 319, - "column": 3, - "index": 9113 - } - }, - "context": { - "loc": { - "start": { - "line": 320, - "column": 0, - "index": 9114 - }, - "end": { - "line": 320, - "column": 28, - "index": 9142 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationY", - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationY", - "scope": "instance" - } - ], - "namespace": "p5#pRotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationZ can also be used with rotationZ to determine the rotate\ndirection of the device along the Z-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 35 - } - ], - "loc": { - "start": { - "line": 322, - "column": 0, - "index": 9144 - }, - "end": { - "line": 358, - "column": 3, - "index": 10350 - } - }, - "context": { - "loc": { - "start": { - "line": 359, - "column": 0, - "index": 10351 - }, - "end": { - "line": 359, - "column": 28, - "index": 10379 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationZ", - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationZ", - "scope": "instance" - } - ], - "namespace": "p5#pRotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When a device is rotated, the axis that triggers the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "deviceTurned()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nmethod is stored in the turnAxis variable. The turnAxis variable is only defined within\nthe scope of deviceTurned()." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "turnAxis" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 379, - "column": 0, - "index": 10890 - }, - "end": { - "line": 412, - "column": 3, - "index": 11826 - } - }, - "context": { - "loc": { - "start": { - "line": 413, - "column": 0, - "index": 11827 - }, - "end": { - "line": 413, - "column": 34, - "index": 11861 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "turnAxis", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "turnAxis", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "turnAxis", - "scope": "instance" - } - ], - "namespace": "p5#turnAxis" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyIsPressed" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is true if any key is pressed\nand false if no keys are pressed." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "keyIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 111 - }, - "end": { - "line": 30, - "column": 3, - "index": 575 - } - }, - "context": { - "loc": { - "start": { - "line": 31, - "column": 0, - "index": 576 - }, - "end": { - "line": 31, - "column": 34, - "index": 610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "isKeyPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "isKeyPressed", - "scope": "instance" - } - ], - "namespace": "p5#isKeyPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyTyped()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". For non-ASCII keys, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyCode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nvariable." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "key" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 34, - "column": 0, - "index": 655 - }, - "end": { - "line": 57, - "column": 3, - "index": 1373 - } - }, - "context": { - "loc": { - "start": { - "line": 58, - "column": 0, - "index": 1374 - }, - "end": { - "line": 58, - "column": 22, - "index": 1396 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "key", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "key", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "key", - "scope": "instance" - } - ], - "namespace": "p5#key" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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: " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keycode.info" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "keyCode" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 60, - "column": 0, - "index": 1398 - }, - "end": { - "line": 95, - "column": 3, - "index": 2425 - } - }, - "context": { - "loc": { - "start": { - "line": 96, - "column": 0, - "index": 2426 - }, - "end": { - "line": 96, - "column": 25, - "index": 2451 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyCode", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "keyCode", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "keyCode", - "scope": "instance" - } - ], - "namespace": "p5#keyCode" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The onblur function is called when the user is no longer focused\non the p5 element. Because the keyup events will not fire if the user is\nnot focused on the element we must assume all keys currently down have\nbeen released." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 291, - "column": 0, - "index": 8735 - }, - "end": { - "line": 296, - "column": 3, - "index": 8978 - } - }, - "context": { - "loc": { - "start": { - "line": 297, - "column": 0, - "index": 8979 - }, - "end": { - "line": 299, - "column": 2, - "index": 9041 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "e", - "lineNumber": 297 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_onblur", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_onblur", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_onblur" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedX contains the horizontal movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 4 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 40, - "column": 3, - "index": 777 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 778 - }, - "end": { - "line": 41, - "column": 24, - "index": 802 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedX", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedX", - "scope": "instance" - } - ], - "namespace": "p5#movedX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedY contains the vertical movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 43, - "column": 0, - "index": 804 - }, - "end": { - "line": 70, - "column": 3, - "index": 1394 - } - }, - "context": { - "loc": { - "start": { - "line": 71, - "column": 0, - "index": 1395 - }, - "end": { - "line": 71, - "column": 24, - "index": 1419 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedY", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedY", - "scope": "instance" - } - ], - "namespace": "p5#movedY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 80, - "column": 0, - "index": 1666 - }, - "end": { - "line": 101, - "column": 3, - "index": 2316 - } - }, - "context": { - "loc": { - "start": { - "line": 102, - "column": 0, - "index": 2317 - }, - "end": { - "line": 102, - "column": 24, - "index": 2341 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseX", - "scope": "instance" - } - ], - "namespace": "p5#mouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 2343 - }, - "end": { - "line": 125, - "column": 3, - "index": 2986 - } - }, - "context": { - "loc": { - "start": { - "line": 126, - "column": 0, - "index": 2987 - }, - "end": { - "line": 126, - "column": 24, - "index": 3011 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseY", - "scope": "instance" - } - ], - "namespace": "p5#mouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 128, - "column": 0, - "index": 3013 - }, - "end": { - "line": 156, - "column": 3, - "index": 3890 - } - }, - "context": { - "loc": { - "start": { - "line": 157, - "column": 0, - "index": 3891 - }, - "end": { - "line": 157, - "column": 25, - "index": 3916 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseX", - "scope": "instance" - } - ], - "namespace": "p5#pmouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 159, - "column": 0, - "index": 3918 - }, - "end": { - "line": 186, - "column": 3, - "index": 4745 - } - }, - "context": { - "loc": { - "start": { - "line": 187, - "column": 0, - "index": 4746 - }, - "end": { - "line": 187, - "column": 25, - "index": 4771 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseY", - "scope": "instance" - } - ], - "namespace": "p5#pmouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseX always contains the current horizontal\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 189, - "column": 0, - "index": 4773 - }, - "end": { - "line": 223, - "column": 3, - "index": 5653 - } - }, - "context": { - "loc": { - "start": { - "line": 224, - "column": 0, - "index": 5654 - }, - "end": { - "line": 224, - "column": 27, - "index": 5681 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseX", - "scope": "instance" - } - ], - "namespace": "p5#winMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseY always contains the current vertical\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 226, - "column": 0, - "index": 5683 - }, - "end": { - "line": 260, - "column": 3, - "index": 6560 - } - }, - "context": { - "loc": { - "start": { - "line": 261, - "column": 0, - "index": 6561 - }, - "end": { - "line": 261, - "column": 27, - "index": 6588 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseY", - "scope": "instance" - } - ], - "namespace": "p5#winMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 263, - "column": 0, - "index": 6590 - }, - "end": { - "line": 299, - "column": 3, - "index": 7675 - } - }, - "context": { - "loc": { - "start": { - "line": 300, - "column": 0, - "index": 7676 - }, - "end": { - "line": 300, - "column": 28, - "index": 7704 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseX", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseX", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 302, - "column": 0, - "index": 7706 - }, - "end": { - "line": 338, - "column": 3, - "index": 8785 - } - }, - "context": { - "loc": { - "start": { - "line": 339, - "column": 0, - "index": 8786 - }, - "end": { - "line": 339, - "column": 28, - "index": 8814 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseY", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseY", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - }, - "name": "mouseButton" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 341, - "column": 0, - "index": 8816 - }, - "end": { - "line": 375, - "column": 3, - "index": 9715 - } - }, - "context": { - "loc": { - "start": { - "line": 376, - "column": 0, - "index": 9716 - }, - "end": { - "line": 376, - "column": 29, - "index": 9745 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseButton", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseButton", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseButton", - "scope": "instance" - } - ], - "namespace": "p5#mouseButton" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable mouseIsPressed is true if the mouse is pressed\nand false if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "mouseIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 378, - "column": 0, - "index": 9747 - }, - "end": { - "line": 404, - "column": 3, - "index": 10289 - } - }, - "context": { - "loc": { - "start": { - "line": 405, - "column": 0, - "index": 10290 - }, - "end": { - "line": 405, - "column": 36, - "index": 10326 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseIsPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseIsPressed", - "scope": "instance" - } - ], - "namespace": "p5#mouseIsPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The touches[] array is not supported on Safari and IE on touch-based\ndesktops (laptops)." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - }, - "name": "touches" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 108 - }, - "end": { - "line": 37, - "column": 3, - "index": 883 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 884 - }, - "end": { - "line": 38, - "column": 26, - "index": 910 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/touch.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "touches", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "touches", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "touches", - "scope": "instance" - } - ], - "namespace": "p5#touches" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An array containing the color of each pixel on the canvas. Colors are\nstored as numbers representing red, green, blue, and alpha (RGBA) values.\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " is a one-dimensional array for performance reasons." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Each pixel occupies four elements in the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array, one for each RGBA\nvalue. For example, the pixel at coordinates (0, 0) stores its RGBA values\nat " - }, - { - "type": "inlineCode", - "value": "pixels[0]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[1]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[2]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[3]" - }, - { - "type": "text", - "value": ", respectively.\nThe next pixel at coordinates (1, 0) stores its RGBA values at " - }, - { - "type": "inlineCode", - "value": "pixels[4]" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "inlineCode", - "value": "pixels[5]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[6]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[7]" - }, - { - "type": "text", - "value": ". And so on. The " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array\nfor a 100×100 canvas has 100 × 100 × 4 = 40,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Some displays use several smaller pixels to set the color at a single\npoint. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function returns\nthe pixel density of the canvas. High density displays often have a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " of 2. On such a display, the\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array for a 100×100 canvas has 200 × 200 × 4 =\n160,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Accessing the RGBA values for a point on the canvas requires a little math\nas shown below. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadPixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function\nmust be called before accessing the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array. The\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "updatePixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function must be called\nafter any changes are made." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "pixels" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 169 - }, - "end": { - "line": 103, - "column": 3, - "index": 3031 - } - }, - "context": { - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 3032 - }, - "end": { - "line": 104, - "column": 25, - "index": 3057 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pixels", - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pixels", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pixels", - "scope": "instance" - } - ], - "namespace": "p5#pixels" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function to measure ascent and descent." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 362, - "column": 0, - "index": 9474 - }, - "end": { - "line": 364, - "column": 3, - "index": 9531 - } - }, - "context": { - "loc": { - "start": { - "line": 365, - "column": 0, - "index": 9532 - }, - "end": { - "line": 367, - "column": 2, - "index": 9627 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_updateTextMetrics", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_updateTextMetrics", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_updateTextMetrics" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ensures that p5 is using a 3d renderer. throws an error if not." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2350, - "column": 0, - "index": 73393 - }, - "end": { - "line": 2352, - "column": 3, - "index": 73467 - } - }, - "context": { - "loc": { - "start": { - "line": 2353, - "column": 0, - "index": 73468 - }, - "end": { - "line": 2358, - "column": 2, - "index": 73742 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "name", - "lineNumber": 2353 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_assert3d", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_assert3d", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_assert3d" - } - ], - "events": [], - "static": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Turn off some features of the friendly error system (FES), which can give\na significant boost to performance when needed." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ndisabling the friendly error system" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "disableFriendlyErrors" - }, - { - "title": "example", - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 754, - "column": 0, - "index": 26038 - }, - "end": { - "line": 776, - "column": 3, - "index": 26889 - } - }, - "context": { - "loc": { - "start": { - "line": 777, - "column": 0, - "index": 26890 - }, - "end": { - "line": 777, - "column": 33, - "index": 26923 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "disableFriendlyErrors", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "disableFriendlyErrors", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "disableFriendlyErrors", - "scope": "static" - } - ], - "namespace": "p5.disableFriendlyErrors" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Path to the media element's source as a string." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.MediaElement", - "lineNumber": 3 - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "src" - }, - { - "title": "return", - "description": "src", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 4842, - "column": 0, - "index": 139686 - }, - "end": { - "line": 4868, - "column": 3, - "index": 140231 - } - }, - "context": { - "loc": { - "start": { - "line": 4958, - "column": 0, - "index": 142394 - }, - "end": { - "line": 5009, - "column": 2, - "index": 143967 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "src" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "File", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "File", - "scope": "static" - } - ], - "namespace": "p5.File" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Table Options\nGeneric class for handling tabular data, typically from a\nCSV, TSV, or other sort of spreadsheet file.\nCSV files are\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ncomma separated values" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", often with the data in quotes. TSV\nfiles use tabs as separators, and usually don't bother with the\nquotes.\nFile names should end with .csv if they're comma separated.\nA rough \"spec\" for CSV can be found\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "here" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nTo load files, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method.\nTo save tables to your computer, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "save" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method\nor the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "saveTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Possible options include:" - } - ] - }, - { - "type": "html", - "value": "
    \n
  • csv - parse the table as comma-separated values\n
  • tsv - parse the table as tab-separated values\n
  • header - this table has a header (title) row\n
" - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 93 - }, - "end": { - "line": 31, - "column": 3, - "index": 1053 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 1379 - }, - "end": { - "line": 1259, - "column": 2, - "index": 33791 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "Table", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addRow()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new row of data to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "set()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object is included as a parameter, then that row is\nduplicated and added to the table." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row to be added to the table", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - "name": "row" - }, - { - "title": "return", - "description": "the row that was added", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 47, - "column": 2, - "index": 1476 - }, - "end": { - "line": 94, - "column": 3, - "index": 2995 - } - }, - "context": { - "loc": { - "start": { - "line": 95, - "column": 2, - "index": 2998 - }, - "end": { - "line": 106, - "column": 3, - "index": 3319 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row to be added to the table" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the row that was added" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes a row from the table object." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to remove", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "id" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 108, - "column": 2, - "index": 3323 - }, - "end": { - "line": 145, - "column": 3, - "index": 4202 - } - }, - "context": { - "loc": { - "start": { - "line": 146, - "column": 2, - "index": 4205 - }, - "end": { - "line": 151, - "column": 3, - "index": 4410 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "id", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to remove" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a reference to the specified " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". The reference\ncan then be used to get and set values of the selected row." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to get", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "rowID" - }, - { - "title": "return", - "description": "p5.TableRow object", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 153, - "column": 2, - "index": 4414 - }, - "end": { - "line": 191, - "column": 3, - "index": 5463 - } - }, - "context": { - "loc": { - "start": { - "line": 192, - "column": 2, - "index": 5466 - }, - "end": { - "line": 194, - "column": 3, - "index": 5507 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "r", - "lineNumber": 192 - }, - { - "title": "param", - "name": "rowID", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to get" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Gets all rows from the table. Returns an array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Array of p5.TableRows", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 196, - "column": 2, - "index": 5511 - }, - "end": { - "line": 237, - "column": 3, - "index": 6588 - } - }, - "context": { - "loc": { - "start": { - "line": 238, - "column": 2, - "index": 6591 - }, - "end": { - "line": 240, - "column": 3, - "index": 6629 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 242, - "column": 2, - "index": 6633 - }, - "end": { - "line": 282, - "column": 3, - "index": 7805 - } - }, - "context": { - "loc": { - "start": { - "line": 283, - "column": 2, - "index": 7808 - }, - "end": { - "line": 301, - "column": 3, - "index": 8272 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 10, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 303, - "column": 2, - "index": 8276 - }, - "end": { - "line": 348, - "column": 3, - "index": 9683 - } - }, - "context": { - "loc": { - "start": { - "line": 349, - "column": 2, - "index": 9686 - }, - "end": { - "line": 366, - "column": 3, - "index": 10136 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "TableRow object", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 368, - "column": 2, - "index": 10140 - }, - "end": { - "line": 407, - "column": 3, - "index": 11362 - } - }, - "context": { - "loc": { - "start": { - "line": 408, - "column": 2, - "index": 11365 - }, - "end": { - "line": 423, - "column": 3, - "index": 11778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "TableRow object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 425, - "column": 2, - "index": 11782 - }, - "end": { - "line": 472, - "column": 3, - "index": 13226 - } - }, - "context": { - "loc": { - "start": { - "line": 473, - "column": 2, - "index": 13229 - }, - "end": { - "line": 489, - "column": 3, - "index": 13668 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all values in the specified column, and returns them\nas an array. The column may be specified by either its ID or title." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String or Number of the column to return", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "Array of column values", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 491, - "column": 2, - "index": 13672 - }, - "end": { - "line": 525, - "column": 3, - "index": 14658 - } - }, - "context": { - "loc": { - "start": { - "line": 526, - "column": 2, - "index": 14661 - }, - "end": { - "line": 538, - "column": 3, - "index": 14980 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 526 - }, - { - "title": "param", - "name": "column", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String or Number of the column to return" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of column values" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes all rows from a Table. While all rows are removed,\ncolumns and column titles are maintained." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 540, - "column": 2, - "index": 14984 - }, - "end": { - "line": 571, - "column": 3, - "index": 15789 - } - }, - "context": { - "loc": { - "start": { - "line": 572, - "column": 2, - "index": 15792 - }, - "end": { - "line": 575, - "column": 3, - "index": 15852 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clearRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "clearRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#clearRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new column to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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.)" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "title of the given column", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "title" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 577, - "column": 2, - "index": 15856 - }, - "end": { - "line": 619, - "column": 3, - "index": 17079 - } - }, - "context": { - "loc": { - "start": { - "line": 620, - "column": 2, - "index": 17082 - }, - "end": { - "line": 623, - "column": 3, - "index": 17160 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "title", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "title of the given column" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of columns in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of columns in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 625, - "column": 2, - "index": 17164 - }, - "end": { - "line": 655, - "column": 3, - "index": 17854 - } - }, - "context": { - "loc": { - "start": { - "line": 656, - "column": 2, - "index": 17857 - }, - "end": { - "line": 658, - "column": 3, - "index": 17912 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of columns in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumnCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumnCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumnCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of rows in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of rows in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 660, - "column": 2, - "index": 17916 - }, - "end": { - "line": 690, - "column": 3, - "index": 18564 - } - }, - "context": { - "loc": { - "start": { - "line": 691, - "column": 2, - "index": 18567 - }, - "end": { - "line": 693, - "column": 3, - "index": 18616 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of rows in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRowCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRowCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRowCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes any of the specified characters (or \"tokens\")." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String listing characters to be removed", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "chars" - }, - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 695, - "column": 2, - "index": 18620 - }, - "end": { - "line": 730, - "column": 3, - "index": 19601 - } - }, - "context": { - "loc": { - "start": { - "line": 731, - "column": 2, - "index": 19604 - }, - "end": { - "line": 764, - "column": 3, - "index": 20779 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "chars", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String listing characters to be removed" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeTokens", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeTokens", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeTokens" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 766, - "column": 2, - "index": 20783 - }, - "end": { - "line": 798, - "column": 3, - "index": 21711 - } - }, - "context": { - "loc": { - "start": { - "line": 799, - "column": 2, - "index": 21714 - }, - "end": { - "line": 827, - "column": 3, - "index": 22666 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "trim", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "trim", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#trim" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "removeColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "columnName (string) or ID (number)", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 829, - "column": 2, - "index": 22670 - }, - "end": { - "line": 864, - "column": 3, - "index": 23691 - } - }, - "context": { - "loc": { - "start": { - "line": 865, - "column": 2, - "index": 23694 - }, - "end": { - "line": 888, - "column": 3, - "index": 24362 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "c", - "lineNumber": 865 - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or ID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 890, - "column": 2, - "index": 24366 - }, - "end": { - "line": 932, - "column": 3, - "index": 25518 - } - }, - "context": { - "loc": { - "start": { - "line": 933, - "column": 2, - "index": 25521 - }, - "end": { - "line": 935, - "column": 3, - "index": 25590 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "set", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "set", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#set" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 937, - "column": 2, - "index": 25594 - }, - "end": { - "line": 976, - "column": 3, - "index": 26578 - } - }, - "context": { - "loc": { - "start": { - "line": 977, - "column": 2, - "index": 26581 - }, - "end": { - "line": 979, - "column": 3, - "index": 26656 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 981, - "column": 2, - "index": 26660 - }, - "end": { - "line": 1019, - "column": 3, - "index": 27767 - } - }, - "context": { - "loc": { - "start": { - "line": 1020, - "column": 2, - "index": 27770 - }, - "end": { - "line": 1022, - "column": 3, - "index": 27851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1024, - "column": 2, - "index": 27855 - }, - "end": { - "line": 1062, - "column": 3, - "index": 28842 - } - }, - "context": { - "loc": { - "start": { - "line": 1063, - "column": 2, - "index": 28845 - }, - "end": { - "line": 1065, - "column": 3, - "index": 28907 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "get", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "get", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#get" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1067, - "column": 2, - "index": 28911 - }, - "end": { - "line": 1103, - "column": 3, - "index": 29853 - } - }, - "context": { - "loc": { - "start": { - "line": 1104, - "column": 2, - "index": 29856 - }, - "end": { - "line": 1106, - "column": 3, - "index": 29924 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1108, - "column": 2, - "index": 29928 - }, - "end": { - "line": 1151, - "column": 3, - "index": 31214 - } - }, - "context": { - "loc": { - "start": { - "line": 1153, - "column": 2, - "index": 31218 - }, - "end": { - "line": 1155, - "column": 3, - "index": 31292 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Name of the column which should be used to\n title each row object (optional)", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "headerColumn" - }, - { - "title": "return", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 1157, - "column": 2, - "index": 31296 - }, - "end": { - "line": 1195, - "column": 3, - "index": 32265 - } - }, - "context": { - "loc": { - "start": { - "line": 1196, - "column": 2, - "index": 32268 - }, - "end": { - "line": 1216, - "column": 3, - "index": 32851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "headerColumn", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Name of the column which should be used to\ntitle each row object (optional)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getObject", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getObject", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getObject" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all table data and returns it as a multidimensional array." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 1218, - "column": 2, - "index": 32855 - }, - "end": { - "line": 1251, - "column": 3, - "index": 33622 - } - }, - "context": { - "loc": { - "start": { - "line": 1252, - "column": 2, - "index": 33625 - }, - "end": { - "line": 1258, - "column": 3, - "index": 33788 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getArray", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getArray" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - } - ], - "namespace": "p5.Table" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An internal class to store data that will be sent to a p5.RenderBuffer.\nThose need to eventually go into a Float32Array, so this class provides a\nvariable-length array container backed by a Float32Array so that it can be\nsent to the GPU without allocating a new array each frame." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Like a C++ vector, its fixed-length Float32Array backing its contents will\ndouble in size when it goes over its capacity." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 3, - "column": 0, - "index": 32 - }, - "end": { - "line": 27, - "column": 3, - "index": 926 - } - }, - "context": { - "loc": { - "start": { - "line": 28, - "column": 0, - "index": 927 - }, - "end": { - "line": 108, - "column": 2, - "index": 2998 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "DataArray", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a Float32Array window sized to the exact length of the data" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 35, - "column": 2, - "index": 1114 - }, - "end": { - "line": 37, - "column": 5, - "index": 1196 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 2, - "index": 1199 - }, - "end": { - "line": 40, - "column": 3, - "index": 1258 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dataArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "dataArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#dataArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A \"soft\" clear, which keeps the underlying storage size the same, but\nempties the contents of its dataArray()" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 42, - "column": 2, - "index": 1262 - }, - "end": { - "line": 45, - "column": 5, - "index": 1391 - } - }, - "context": { - "loc": { - "start": { - "line": 46, - "column": 2, - "index": 1394 - }, - "end": { - "line": 48, - "column": 3, - "index": 1428 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clear", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "clear", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#clear" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Can be used to scale a DataArray back down to fit its contents." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 50, - "column": 2, - "index": 1432 - }, - "end": { - "line": 52, - "column": 5, - "index": 1510 - } - }, - "context": { - "loc": { - "start": { - "line": 53, - "column": 2, - "index": 1513 - }, - "end": { - "line": 61, - "column": 3, - "index": 1839 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rescale", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "rescale", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#rescale" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A full reset, which allocates a new underlying Float32Array at its initial\nlength" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 63, - "column": 2, - "index": 1843 - }, - "end": { - "line": 66, - "column": 5, - "index": 1944 - } - }, - "context": { - "loc": { - "start": { - "line": 67, - "column": 2, - "index": 1947 - }, - "end": { - "line": 70, - "column": 3, - "index": 2032 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "reset", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "reset", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#reset" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Adds values to the DataArray, expanding its internal storage to\naccommodate the new items." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 72, - "column": 2, - "index": 2036 - }, - "end": { - "line": 75, - "column": 5, - "index": 2146 - } - }, - "context": { - "loc": { - "start": { - "line": 76, - "column": 2, - "index": 2149 - }, - "end": { - "line": 80, - "column": 3, - "index": 2296 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "values", - "lineNumber": 76, - "type": { - "type": "RestType" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "push", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "push", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#push" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a copy of the data from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to the index\n" - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 82, - "column": 2, - "index": 2300 - }, - "end": { - "line": 85, - "column": 5, - "index": 2409 - } - }, - "context": { - "loc": { - "start": { - "line": 86, - "column": 2, - "index": 2412 - }, - "end": { - "line": 88, - "column": 3, - "index": 2494 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 86 - }, - { - "title": "param", - "name": "to", - "lineNumber": 86 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "slice", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "slice", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#slice" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a mutable Float32Array window from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to\nthe index " - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 90, - "column": 2, - "index": 2498 - }, - "end": { - "line": 93, - "column": 5, - "index": 2618 - } - }, - "context": { - "loc": { - "start": { - "line": 94, - "column": 2, - "index": 2621 - }, - "end": { - "line": 96, - "column": 3, - "index": 2709 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 94 - }, - { - "title": "param", - "name": "to", - "lineNumber": 94 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "subArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "subArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#subArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Expand capacity of the internal storage until it can fit a target size" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 98, - "column": 2, - "index": 2713 - }, - "end": { - "line": 100, - "column": 5, - "index": 2798 - } - }, - "context": { - "loc": { - "start": { - "line": 101, - "column": 2, - "index": 2801 - }, - "end": { - "line": 107, - "column": 3, - "index": 2995 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "target", - "lineNumber": 101 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "ensureLength", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "ensureLength", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#ensureLength" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - } - ], - "namespace": "p5.DataArray" - } - ] - }, - "path": [ - { - "name": "p5" - } - ], - "namespace": "p5" - }, - { - "description": "", - "tags": [ - { - "title": "for", - "description": "p5", - "lineNumber": 1 - }, - { - "title": "requires", - "description": null, - "lineNumber": 2, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 4, - "column": 3, - "index": 36 - } - }, - "context": { - "loc": { - "start": { - "line": 5, - "column": 0, - "index": 37 - }, - "end": { - "line": 5, - "column": 25, - "index": 62 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/friendly_errors/file_errors.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "p5", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the number of frames drawn since the sketch started." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "frameCount" - }, - { - "type": "text", - "value": "'s value is 0 inside " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". It\nincrements by 1 each time the code in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfinishes executing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "frameCount" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 69, - "column": 0, - "index": 1553 - }, - "end": { - "line": 116, - "column": 3, - "index": 2581 - } - }, - "context": { - "loc": { - "start": { - "line": 117, - "column": 0, - "index": 2582 - }, - "end": { - "line": 117, - "column": 28, - "index": 2610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "frameCount", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "frameCount", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "frameCount", - "scope": "instance" - } - ], - "namespace": "p5#frameCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the amount of time, in milliseconds, it took for\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to draw the previous frame. " - }, - { - "type": "inlineCode", - "value": "deltaTime" - }, - { - "type": "text", - "value": " is\nuseful for simulating physics." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "deltaTime" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 2612 - }, - "end": { - "line": 161, - "column": 3, - "index": 3539 - } - }, - "context": { - "loc": { - "start": { - "line": 162, - "column": 0, - "index": 3540 - }, - "end": { - "line": 162, - "column": 27, - "index": 3567 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deltaTime", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deltaTime", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deltaTime", - "scope": "instance" - } - ], - "namespace": "p5#deltaTime" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks whether the browser window is focused and can receive user input.\n" - }, - { - "type": "inlineCode", - "value": "focused" - }, - { - "type": "text", - "value": " is " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": " if the window if focused and " - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "focused" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 164, - "column": 0, - "index": 3569 - }, - "end": { - "line": 190, - "column": 3, - "index": 4257 - } - }, - "context": { - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 4258 - }, - "end": { - "line": 191, - "column": 43, - "index": 4301 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "focused", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "focused", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "focused", - "scope": "instance" - } - ], - "namespace": "p5#focused" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A string variable with the WebGL version in use. Its value equals one of\nthe followin string constants:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL2" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl2'" - }, - { - "type": "text", - "value": "," - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl'" - }, - { - "type": "text", - "value": ", or" - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "P2D" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'p2d'" - }, - { - "type": "text", - "value": ". This is the default for 2D sketches." - } - ] - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setAttributes()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for ways to set the\nWebGL version." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - }, - "name": "webglVersion" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 12 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 466, - "column": 0, - "index": 12055 - }, - "end": { - "line": 544, - "column": 3, - "index": 13784 - } - }, - "context": { - "loc": { - "start": { - "line": 545, - "column": 0, - "index": 13785 - }, - "end": { - "line": 545, - "column": 34, - "index": 13819 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "webglVersion", - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "webglVersion", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "webglVersion", - "scope": "instance" - } - ], - "namespace": "p5#webglVersion" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayWidth" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen width can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayWidth * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 547, - "column": 0, - "index": 13821 - }, - "end": { - "line": 574, - "column": 3, - "index": 14559 - } - }, - "context": { - "loc": { - "start": { - "line": 575, - "column": 0, - "index": 14560 - }, - "end": { - "line": 575, - "column": 41, - "index": 14601 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayWidth", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayWidth", - "scope": "instance" - } - ], - "namespace": "p5#displayWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayHeight" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen height can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayHeight * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 577, - "column": 0, - "index": 14603 - }, - "end": { - "line": 604, - "column": 3, - "index": 15346 - } - }, - "context": { - "loc": { - "start": { - "line": 605, - "column": 0, - "index": 15347 - }, - "end": { - "line": 605, - "column": 43, - "index": 15390 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayHeight", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayHeight", - "scope": "instance" - } - ], - "namespace": "p5#displayHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 607, - "column": 0, - "index": 15392 - }, - "end": { - "line": 631, - "column": 3, - "index": 16081 - } - }, - "context": { - "loc": { - "start": { - "line": 632, - "column": 0, - "index": 16082 - }, - "end": { - "line": 632, - "column": 44, - "index": 16126 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowWidth", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowWidth", - "scope": "instance" - } - ], - "namespace": "p5#windowWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 634, - "column": 0, - "index": 16128 - }, - "end": { - "line": 658, - "column": 3, - "index": 16819 - } - }, - "context": { - "loc": { - "start": { - "line": 659, - "column": 0, - "index": 16820 - }, - "end": { - "line": 659, - "column": 46, - "index": 16866 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowHeight", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowHeight", - "scope": "instance" - } - ], - "namespace": "p5#windowHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "width" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "width" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 750, - "column": 0, - "index": 19217 - }, - "end": { - "line": 816, - "column": 3, - "index": 20713 - } - }, - "context": { - "loc": { - "start": { - "line": 817, - "column": 0, - "index": 20714 - }, - "end": { - "line": 817, - "column": 23, - "index": 20737 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "width", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "width", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "width", - "scope": "instance" - } - ], - "namespace": "p5#width" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "height" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "height" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 819, - "column": 0, - "index": 20739 - }, - "end": { - "line": 885, - "column": 3, - "index": 22246 - } - }, - "context": { - "loc": { - "start": { - "line": 886, - "column": 0, - "index": 22247 - }, - "end": { - "line": 886, - "column": 24, - "index": 22271 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "height", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "height", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "height", - "scope": "instance" - } - ], - "namespace": "p5#height" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "nothing displayed", - "lineNumber": 20 - } - ], - "loc": { - "start": { - "line": 317, - "column": 4, - "index": 10982 - }, - "end": { - "line": 340, - "column": 7, - "index": 11811 - } - }, - "context": { - "loc": { - "start": { - "line": 341, - "column": 4, - "index": 11816 - }, - "end": { - "line": 402, - "column": 6, - "index": 13726 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "remove", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "remove", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#remove" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function does 3 things:" - } - ] - }, - { - "type": "list", - "ordered": true, - "start": 1, - "spread": true, - "children": [ - { - "type": "listItem", - "spread": true, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Bounds the desired start/stop angles for an arc (in radians) so that:" - } - ] - }, - { - "type": "code", - "lang": null, - "meta": null, - "value": "0 <= start < TWO_PI ; start <= stop < start + TWO_PI" - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This means that the arc rendering functions don't have to be concerned\nwith what happens if stop is smaller than start, or if the arc 'goes\nround more than once', etc.: they can just start at start and increase\nuntil stop and the correct arc will be drawn." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Optionally adjusts the angles within each quadrant to counter the naive\nscaling of the underlying ellipse up from the unit circle. Without\nthis, the angles become arbitrary when width != height: 45 degrees\nmight be drawn at 5 degrees on a 'wide' ellipse, or at 85 degrees on\na 'tall' ellipse." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Flags up when start and stop correspond to the same place on the\nunderlying ellipse. This is useful if you want to do something special\nthere (like rendering a whole ellipse instead)." - } - ] - } - ] - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 16, - "column": 0, - "index": 333 - }, - "end": { - "line": 37, - "column": 3, - "index": 1365 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 1366 - }, - "end": { - "line": 100, - "column": 2, - "index": 3623 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "start", - "lineNumber": 39 - }, - { - "title": "param", - "name": "stop", - "lineNumber": 40 - }, - { - "title": "param", - "name": "width", - "lineNumber": 41 - }, - { - "title": "param", - "name": "height", - "lineNumber": 42 - }, - { - "title": "param", - "name": "correctForScaling", - "lineNumber": 43 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_normalizeArcAngles", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_normalizeArcAngles", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_normalizeArcAngles" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for select and selectAll" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 6392 - }, - "end": { - "line": 193, - "column": 3, - "index": 6443 - } - }, - "context": { - "loc": { - "start": { - "line": 194, - "column": 0, - "index": 6444 - }, - "end": { - "line": 204, - "column": 2, - "index": 6751 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "p", - "lineNumber": 194 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_getContainer", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_getContainer", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_getContainer" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for getElement and getElements." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 206, - "column": 0, - "index": 6753 - }, - "end": { - "line": 208, - "column": 3, - "index": 6811 - } - }, - "context": { - "loc": { - "start": { - "line": 209, - "column": 0, - "index": 6812 - }, - "end": { - "line": 238, - "column": 2, - "index": 7767 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "elt", - "lineNumber": 209 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_wrapElement", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_wrapElement", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_wrapElement" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "INPUT *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 715, - "column": 0, - "index": 21883 - }, - "end": { - "line": 715, - "column": 13, - "index": 21896 - } - }, - "context": { - "loc": { - "start": { - "line": 827, - "column": 0, - "index": 24953 - }, - "end": { - "line": 840, - "column": 2, - "index": 25384 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "min", - "lineNumber": 827 - }, - { - "title": "param", - "name": "max", - "lineNumber": 827 - }, - { - "title": "param", - "name": "value", - "lineNumber": 827 - }, - { - "title": "param", - "name": "step", - "lineNumber": 827 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createSlider", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createSlider", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createSlider" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "AUDIO STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2041, - "column": 0, - "index": 61417 - }, - "end": { - "line": 2041, - "column": 19, - "index": 61436 - } - }, - "context": { - "loc": { - "start": { - "line": 2080, - "column": 0, - "index": 62975 - }, - "end": { - "line": 2083, - "column": 2, - "index": 63135 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "src", - "lineNumber": 2080 - }, - { - "title": "param", - "name": "callback", - "lineNumber": 2080 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createAudio", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createAudio", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createAudio" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "CAMERA STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2085, - "column": 0, - "index": 63137 - }, - "end": { - "line": 2085, - "column": 20, - "index": 63157 - } - }, - "context": { - "loc": { - "start": { - "line": 2087, - "column": 0, - "index": 63159 - }, - "end": { - "line": 2087, - "column": 29, - "index": 63188 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "VIDEO", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "VIDEO", - "scope": "instance" - } - ], - "namespace": "p5#VIDEO" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - }, - "name": "deviceOrientation" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 20, - "column": 3, - "index": 511 - } - }, - "context": { - "loc": { - "start": { - "line": 21, - "column": 0, - "index": 512 - }, - "end": { - "line": 22, - "column": 74, - "index": 619 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deviceOrientation", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deviceOrientation", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deviceOrientation", - "scope": "instance" - } - ], - "namespace": "p5#deviceOrientation" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationX always contains the acceleration of the\ndevice along the x axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 24, - "column": 0, - "index": 621 - }, - "end": { - "line": 43, - "column": 3, - "index": 1167 - } - }, - "context": { - "loc": { - "start": { - "line": 44, - "column": 0, - "index": 1168 - }, - "end": { - "line": 44, - "column": 31, - "index": 1199 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationX", - "scope": "instance" - } - ], - "namespace": "p5#accelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationY always contains the acceleration of the\ndevice along the y axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 46, - "column": 0, - "index": 1201 - }, - "end": { - "line": 65, - "column": 3, - "index": 1746 - } - }, - "context": { - "loc": { - "start": { - "line": 66, - "column": 0, - "index": 1747 - }, - "end": { - "line": 66, - "column": 31, - "index": 1778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationY", - "scope": "instance" - } - ], - "namespace": "p5#accelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationZ always contains the acceleration of the\ndevice along the z axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 68, - "column": 0, - "index": 1780 - }, - "end": { - "line": 88, - "column": 3, - "index": 2328 - } - }, - "context": { - "loc": { - "start": { - "line": 89, - "column": 0, - "index": 2329 - }, - "end": { - "line": 89, - "column": 31, - "index": 2360 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationZ", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#accelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 91, - "column": 0, - "index": 2362 - }, - "end": { - "line": 98, - "column": 3, - "index": 2625 - } - }, - "context": { - "loc": { - "start": { - "line": 99, - "column": 0, - "index": 2626 - }, - "end": { - "line": 99, - "column": 32, - "index": 2658 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationX", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationX", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 101, - "column": 0, - "index": 2660 - }, - "end": { - "line": 108, - "column": 3, - "index": 2923 - } - }, - "context": { - "loc": { - "start": { - "line": 109, - "column": 0, - "index": 2924 - }, - "end": { - "line": 109, - "column": 32, - "index": 2956 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationY", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationY", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 111, - "column": 0, - "index": 2958 - }, - "end": { - "line": 118, - "column": 3, - "index": 3221 - } - }, - "context": { - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 3222 - }, - "end": { - "line": 119, - "column": 32, - "index": 3254 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationZ", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationX always contains the rotation of the\ndevice along the x axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES, the value will be -180 to 180. If\nit is set to RADIANS, the value will be -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 132, - "column": 0, - "index": 3568 - }, - "end": { - "line": 162, - "column": 3, - "index": 4447 - } - }, - "context": { - "loc": { - "start": { - "line": 163, - "column": 0, - "index": 4448 - }, - "end": { - "line": 163, - "column": 27, - "index": 4475 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationX", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationX", - "scope": "instance" - } - ], - "namespace": "p5#rotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationY always contains the rotation of the\ndevice along the y axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 165, - "column": 0, - "index": 4477 - }, - "end": { - "line": 195, - "column": 3, - "index": 5358 - } - }, - "context": { - "loc": { - "start": { - "line": 196, - "column": 0, - "index": 5359 - }, - "end": { - "line": 196, - "column": 27, - "index": 5386 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationY", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationY", - "scope": "instance" - } - ], - "namespace": "p5#rotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationZ always contains the rotation of the\ndevice along the z axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Unlike rotationX and rotationY, this variable is available for devices\nwith a built-in compass only." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - }, - { - "title": "property", - "description": null, - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 33 - } - ], - "loc": { - "start": { - "line": 198, - "column": 0, - "index": 5388 - }, - "end": { - "line": 232, - "column": 3, - "index": 6377 - } - }, - "context": { - "loc": { - "start": { - "line": 233, - "column": 0, - "index": 6378 - }, - "end": { - "line": 233, - "column": 27, - "index": 6405 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationZ", - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationZ", - "scope": "instance" - } - ], - "namespace": "p5#rotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES,\nthe value will be -180 to 180. If it is set to RADIANS, the value will\nbe -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationX can also be used with rotationX to determine the rotate\ndirection of the device along the X-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 40 - } - ], - "loc": { - "start": { - "line": 235, - "column": 0, - "index": 6407 - }, - "end": { - "line": 276, - "column": 3, - "index": 7745 - } - }, - "context": { - "loc": { - "start": { - "line": 277, - "column": 0, - "index": 7746 - }, - "end": { - "line": 277, - "column": 28, - "index": 7774 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationX", - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationX", - "scope": "instance" - } - ], - "namespace": "p5#pRotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationY can also be used with rotationY to determine the rotate\ndirection of the device along the Y-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 39 - } - ], - "loc": { - "start": { - "line": 279, - "column": 0, - "index": 7776 - }, - "end": { - "line": 319, - "column": 3, - "index": 9113 - } - }, - "context": { - "loc": { - "start": { - "line": 320, - "column": 0, - "index": 9114 - }, - "end": { - "line": 320, - "column": 28, - "index": 9142 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationY", - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationY", - "scope": "instance" - } - ], - "namespace": "p5#pRotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationZ can also be used with rotationZ to determine the rotate\ndirection of the device along the Z-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 35 - } - ], - "loc": { - "start": { - "line": 322, - "column": 0, - "index": 9144 - }, - "end": { - "line": 358, - "column": 3, - "index": 10350 - } - }, - "context": { - "loc": { - "start": { - "line": 359, - "column": 0, - "index": 10351 - }, - "end": { - "line": 359, - "column": 28, - "index": 10379 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationZ", - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationZ", - "scope": "instance" - } - ], - "namespace": "p5#pRotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When a device is rotated, the axis that triggers the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "deviceTurned()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nmethod is stored in the turnAxis variable. The turnAxis variable is only defined within\nthe scope of deviceTurned()." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "turnAxis" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 379, - "column": 0, - "index": 10890 - }, - "end": { - "line": 412, - "column": 3, - "index": 11826 - } - }, - "context": { - "loc": { - "start": { - "line": 413, - "column": 0, - "index": 11827 - }, - "end": { - "line": 413, - "column": 34, - "index": 11861 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "turnAxis", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "turnAxis", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "turnAxis", - "scope": "instance" - } - ], - "namespace": "p5#turnAxis" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyIsPressed" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is true if any key is pressed\nand false if no keys are pressed." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "keyIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 111 - }, - "end": { - "line": 30, - "column": 3, - "index": 575 - } - }, - "context": { - "loc": { - "start": { - "line": 31, - "column": 0, - "index": 576 - }, - "end": { - "line": 31, - "column": 34, - "index": 610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "isKeyPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "isKeyPressed", - "scope": "instance" - } - ], - "namespace": "p5#isKeyPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyTyped()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". For non-ASCII keys, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyCode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nvariable." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "key" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 34, - "column": 0, - "index": 655 - }, - "end": { - "line": 57, - "column": 3, - "index": 1373 - } - }, - "context": { - "loc": { - "start": { - "line": 58, - "column": 0, - "index": 1374 - }, - "end": { - "line": 58, - "column": 22, - "index": 1396 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "key", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "key", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "key", - "scope": "instance" - } - ], - "namespace": "p5#key" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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: " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keycode.info" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "keyCode" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 60, - "column": 0, - "index": 1398 - }, - "end": { - "line": 95, - "column": 3, - "index": 2425 - } - }, - "context": { - "loc": { - "start": { - "line": 96, - "column": 0, - "index": 2426 - }, - "end": { - "line": 96, - "column": 25, - "index": 2451 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyCode", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "keyCode", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "keyCode", - "scope": "instance" - } - ], - "namespace": "p5#keyCode" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The onblur function is called when the user is no longer focused\non the p5 element. Because the keyup events will not fire if the user is\nnot focused on the element we must assume all keys currently down have\nbeen released." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 291, - "column": 0, - "index": 8735 - }, - "end": { - "line": 296, - "column": 3, - "index": 8978 - } - }, - "context": { - "loc": { - "start": { - "line": 297, - "column": 0, - "index": 8979 - }, - "end": { - "line": 299, - "column": 2, - "index": 9041 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "e", - "lineNumber": 297 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_onblur", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_onblur", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_onblur" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedX contains the horizontal movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 4 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 40, - "column": 3, - "index": 777 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 778 - }, - "end": { - "line": 41, - "column": 24, - "index": 802 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedX", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedX", - "scope": "instance" - } - ], - "namespace": "p5#movedX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedY contains the vertical movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 43, - "column": 0, - "index": 804 - }, - "end": { - "line": 70, - "column": 3, - "index": 1394 - } - }, - "context": { - "loc": { - "start": { - "line": 71, - "column": 0, - "index": 1395 - }, - "end": { - "line": 71, - "column": 24, - "index": 1419 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedY", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedY", - "scope": "instance" - } - ], - "namespace": "p5#movedY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 80, - "column": 0, - "index": 1666 - }, - "end": { - "line": 101, - "column": 3, - "index": 2316 - } - }, - "context": { - "loc": { - "start": { - "line": 102, - "column": 0, - "index": 2317 - }, - "end": { - "line": 102, - "column": 24, - "index": 2341 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseX", - "scope": "instance" - } - ], - "namespace": "p5#mouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 2343 - }, - "end": { - "line": 125, - "column": 3, - "index": 2986 - } - }, - "context": { - "loc": { - "start": { - "line": 126, - "column": 0, - "index": 2987 - }, - "end": { - "line": 126, - "column": 24, - "index": 3011 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseY", - "scope": "instance" - } - ], - "namespace": "p5#mouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 128, - "column": 0, - "index": 3013 - }, - "end": { - "line": 156, - "column": 3, - "index": 3890 - } - }, - "context": { - "loc": { - "start": { - "line": 157, - "column": 0, - "index": 3891 - }, - "end": { - "line": 157, - "column": 25, - "index": 3916 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseX", - "scope": "instance" - } - ], - "namespace": "p5#pmouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 159, - "column": 0, - "index": 3918 - }, - "end": { - "line": 186, - "column": 3, - "index": 4745 - } - }, - "context": { - "loc": { - "start": { - "line": 187, - "column": 0, - "index": 4746 - }, - "end": { - "line": 187, - "column": 25, - "index": 4771 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseY", - "scope": "instance" - } - ], - "namespace": "p5#pmouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseX always contains the current horizontal\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 189, - "column": 0, - "index": 4773 - }, - "end": { - "line": 223, - "column": 3, - "index": 5653 - } - }, - "context": { - "loc": { - "start": { - "line": 224, - "column": 0, - "index": 5654 - }, - "end": { - "line": 224, - "column": 27, - "index": 5681 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseX", - "scope": "instance" - } - ], - "namespace": "p5#winMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseY always contains the current vertical\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 226, - "column": 0, - "index": 5683 - }, - "end": { - "line": 260, - "column": 3, - "index": 6560 - } - }, - "context": { - "loc": { - "start": { - "line": 261, - "column": 0, - "index": 6561 - }, - "end": { - "line": 261, - "column": 27, - "index": 6588 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseY", - "scope": "instance" - } - ], - "namespace": "p5#winMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 263, - "column": 0, - "index": 6590 - }, - "end": { - "line": 299, - "column": 3, - "index": 7675 - } - }, - "context": { - "loc": { - "start": { - "line": 300, - "column": 0, - "index": 7676 - }, - "end": { - "line": 300, - "column": 28, - "index": 7704 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseX", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseX", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 302, - "column": 0, - "index": 7706 - }, - "end": { - "line": 338, - "column": 3, - "index": 8785 - } - }, - "context": { - "loc": { - "start": { - "line": 339, - "column": 0, - "index": 8786 - }, - "end": { - "line": 339, - "column": 28, - "index": 8814 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseY", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseY", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - }, - "name": "mouseButton" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 341, - "column": 0, - "index": 8816 - }, - "end": { - "line": 375, - "column": 3, - "index": 9715 - } - }, - "context": { - "loc": { - "start": { - "line": 376, - "column": 0, - "index": 9716 - }, - "end": { - "line": 376, - "column": 29, - "index": 9745 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseButton", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseButton", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseButton", - "scope": "instance" - } - ], - "namespace": "p5#mouseButton" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable mouseIsPressed is true if the mouse is pressed\nand false if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "mouseIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 378, - "column": 0, - "index": 9747 - }, - "end": { - "line": 404, - "column": 3, - "index": 10289 - } - }, - "context": { - "loc": { - "start": { - "line": 405, - "column": 0, - "index": 10290 - }, - "end": { - "line": 405, - "column": 36, - "index": 10326 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseIsPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseIsPressed", - "scope": "instance" - } - ], - "namespace": "p5#mouseIsPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The touches[] array is not supported on Safari and IE on touch-based\ndesktops (laptops)." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - }, - "name": "touches" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 108 - }, - "end": { - "line": 37, - "column": 3, - "index": 883 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 884 - }, - "end": { - "line": 38, - "column": 26, - "index": 910 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/touch.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "touches", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "touches", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "touches", - "scope": "instance" - } - ], - "namespace": "p5#touches" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An array containing the color of each pixel on the canvas. Colors are\nstored as numbers representing red, green, blue, and alpha (RGBA) values.\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " is a one-dimensional array for performance reasons." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Each pixel occupies four elements in the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array, one for each RGBA\nvalue. For example, the pixel at coordinates (0, 0) stores its RGBA values\nat " - }, - { - "type": "inlineCode", - "value": "pixels[0]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[1]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[2]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[3]" - }, - { - "type": "text", - "value": ", respectively.\nThe next pixel at coordinates (1, 0) stores its RGBA values at " - }, - { - "type": "inlineCode", - "value": "pixels[4]" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "inlineCode", - "value": "pixels[5]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[6]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[7]" - }, - { - "type": "text", - "value": ". And so on. The " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array\nfor a 100×100 canvas has 100 × 100 × 4 = 40,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Some displays use several smaller pixels to set the color at a single\npoint. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function returns\nthe pixel density of the canvas. High density displays often have a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " of 2. On such a display, the\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array for a 100×100 canvas has 200 × 200 × 4 =\n160,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Accessing the RGBA values for a point on the canvas requires a little math\nas shown below. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadPixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function\nmust be called before accessing the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array. The\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "updatePixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function must be called\nafter any changes are made." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "pixels" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 169 - }, - "end": { - "line": 103, - "column": 3, - "index": 3031 - } - }, - "context": { - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 3032 - }, - "end": { - "line": 104, - "column": 25, - "index": 3057 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pixels", - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pixels", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pixels", - "scope": "instance" - } - ], - "namespace": "p5#pixels" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function to measure ascent and descent." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 362, - "column": 0, - "index": 9474 - }, - "end": { - "line": 364, - "column": 3, - "index": 9531 - } - }, - "context": { - "loc": { - "start": { - "line": 365, - "column": 0, - "index": 9532 - }, - "end": { - "line": 367, - "column": 2, - "index": 9627 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_updateTextMetrics", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_updateTextMetrics", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_updateTextMetrics" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ensures that p5 is using a 3d renderer. throws an error if not." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2350, - "column": 0, - "index": 73393 - }, - "end": { - "line": 2352, - "column": 3, - "index": 73467 - } - }, - "context": { - "loc": { - "start": { - "line": 2353, - "column": 0, - "index": 73468 - }, - "end": { - "line": 2358, - "column": 2, - "index": 73742 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "name", - "lineNumber": 2353 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_assert3d", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_assert3d", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_assert3d" - } - ], - "events": [], - "static": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Turn off some features of the friendly error system (FES), which can give\na significant boost to performance when needed." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ndisabling the friendly error system" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "disableFriendlyErrors" - }, - { - "title": "example", - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 754, - "column": 0, - "index": 26038 - }, - "end": { - "line": 776, - "column": 3, - "index": 26889 - } - }, - "context": { - "loc": { - "start": { - "line": 777, - "column": 0, - "index": 26890 - }, - "end": { - "line": 777, - "column": 33, - "index": 26923 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "disableFriendlyErrors", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "disableFriendlyErrors", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "disableFriendlyErrors", - "scope": "static" - } - ], - "namespace": "p5.disableFriendlyErrors" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Path to the media element's source as a string." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.MediaElement", - "lineNumber": 3 - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "src" - }, - { - "title": "return", - "description": "src", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 4842, - "column": 0, - "index": 139686 - }, - "end": { - "line": 4868, - "column": 3, - "index": 140231 - } - }, - "context": { - "loc": { - "start": { - "line": 4958, - "column": 0, - "index": 142394 - }, - "end": { - "line": 5009, - "column": 2, - "index": 143967 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "src" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "File", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "File", - "scope": "static" - } - ], - "namespace": "p5.File" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Table Options\nGeneric class for handling tabular data, typically from a\nCSV, TSV, or other sort of spreadsheet file.\nCSV files are\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ncomma separated values" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", often with the data in quotes. TSV\nfiles use tabs as separators, and usually don't bother with the\nquotes.\nFile names should end with .csv if they're comma separated.\nA rough \"spec\" for CSV can be found\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "here" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nTo load files, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method.\nTo save tables to your computer, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "save" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method\nor the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "saveTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Possible options include:" - } - ] - }, - { - "type": "html", - "value": "
    \n
  • csv - parse the table as comma-separated values\n
  • tsv - parse the table as tab-separated values\n
  • header - this table has a header (title) row\n
" - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 93 - }, - "end": { - "line": 31, - "column": 3, - "index": 1053 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 1379 - }, - "end": { - "line": 1259, - "column": 2, - "index": 33791 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "Table", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addRow()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new row of data to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "set()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object is included as a parameter, then that row is\nduplicated and added to the table." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row to be added to the table", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - "name": "row" - }, - { - "title": "return", - "description": "the row that was added", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 47, - "column": 2, - "index": 1476 - }, - "end": { - "line": 94, - "column": 3, - "index": 2995 - } - }, - "context": { - "loc": { - "start": { - "line": 95, - "column": 2, - "index": 2998 - }, - "end": { - "line": 106, - "column": 3, - "index": 3319 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row to be added to the table" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the row that was added" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes a row from the table object." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to remove", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "id" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 108, - "column": 2, - "index": 3323 - }, - "end": { - "line": 145, - "column": 3, - "index": 4202 - } - }, - "context": { - "loc": { - "start": { - "line": 146, - "column": 2, - "index": 4205 - }, - "end": { - "line": 151, - "column": 3, - "index": 4410 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "id", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to remove" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a reference to the specified " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". The reference\ncan then be used to get and set values of the selected row." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to get", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "rowID" - }, - { - "title": "return", - "description": "p5.TableRow object", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 153, - "column": 2, - "index": 4414 - }, - "end": { - "line": 191, - "column": 3, - "index": 5463 - } - }, - "context": { - "loc": { - "start": { - "line": 192, - "column": 2, - "index": 5466 - }, - "end": { - "line": 194, - "column": 3, - "index": 5507 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "r", - "lineNumber": 192 - }, - { - "title": "param", - "name": "rowID", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to get" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Gets all rows from the table. Returns an array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Array of p5.TableRows", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 196, - "column": 2, - "index": 5511 - }, - "end": { - "line": 237, - "column": 3, - "index": 6588 - } - }, - "context": { - "loc": { - "start": { - "line": 238, - "column": 2, - "index": 6591 - }, - "end": { - "line": 240, - "column": 3, - "index": 6629 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 242, - "column": 2, - "index": 6633 - }, - "end": { - "line": 282, - "column": 3, - "index": 7805 - } - }, - "context": { - "loc": { - "start": { - "line": 283, - "column": 2, - "index": 7808 - }, - "end": { - "line": 301, - "column": 3, - "index": 8272 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 10, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 303, - "column": 2, - "index": 8276 - }, - "end": { - "line": 348, - "column": 3, - "index": 9683 - } - }, - "context": { - "loc": { - "start": { - "line": 349, - "column": 2, - "index": 9686 - }, - "end": { - "line": 366, - "column": 3, - "index": 10136 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "TableRow object", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 368, - "column": 2, - "index": 10140 - }, - "end": { - "line": 407, - "column": 3, - "index": 11362 - } - }, - "context": { - "loc": { - "start": { - "line": 408, - "column": 2, - "index": 11365 - }, - "end": { - "line": 423, - "column": 3, - "index": 11778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "TableRow object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 425, - "column": 2, - "index": 11782 - }, - "end": { - "line": 472, - "column": 3, - "index": 13226 - } - }, - "context": { - "loc": { - "start": { - "line": 473, - "column": 2, - "index": 13229 - }, - "end": { - "line": 489, - "column": 3, - "index": 13668 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all values in the specified column, and returns them\nas an array. The column may be specified by either its ID or title." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String or Number of the column to return", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "Array of column values", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 491, - "column": 2, - "index": 13672 - }, - "end": { - "line": 525, - "column": 3, - "index": 14658 - } - }, - "context": { - "loc": { - "start": { - "line": 526, - "column": 2, - "index": 14661 - }, - "end": { - "line": 538, - "column": 3, - "index": 14980 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 526 - }, - { - "title": "param", - "name": "column", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String or Number of the column to return" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of column values" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes all rows from a Table. While all rows are removed,\ncolumns and column titles are maintained." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 540, - "column": 2, - "index": 14984 - }, - "end": { - "line": 571, - "column": 3, - "index": 15789 - } - }, - "context": { - "loc": { - "start": { - "line": 572, - "column": 2, - "index": 15792 - }, - "end": { - "line": 575, - "column": 3, - "index": 15852 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clearRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "clearRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#clearRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new column to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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.)" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "title of the given column", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "title" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 577, - "column": 2, - "index": 15856 - }, - "end": { - "line": 619, - "column": 3, - "index": 17079 - } - }, - "context": { - "loc": { - "start": { - "line": 620, - "column": 2, - "index": 17082 - }, - "end": { - "line": 623, - "column": 3, - "index": 17160 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "title", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "title of the given column" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of columns in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of columns in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 625, - "column": 2, - "index": 17164 - }, - "end": { - "line": 655, - "column": 3, - "index": 17854 - } - }, - "context": { - "loc": { - "start": { - "line": 656, - "column": 2, - "index": 17857 - }, - "end": { - "line": 658, - "column": 3, - "index": 17912 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of columns in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumnCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumnCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumnCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of rows in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of rows in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 660, - "column": 2, - "index": 17916 - }, - "end": { - "line": 690, - "column": 3, - "index": 18564 - } - }, - "context": { - "loc": { - "start": { - "line": 691, - "column": 2, - "index": 18567 - }, - "end": { - "line": 693, - "column": 3, - "index": 18616 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of rows in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRowCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRowCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRowCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes any of the specified characters (or \"tokens\")." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String listing characters to be removed", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "chars" - }, - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 695, - "column": 2, - "index": 18620 - }, - "end": { - "line": 730, - "column": 3, - "index": 19601 - } - }, - "context": { - "loc": { - "start": { - "line": 731, - "column": 2, - "index": 19604 - }, - "end": { - "line": 764, - "column": 3, - "index": 20779 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "chars", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String listing characters to be removed" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeTokens", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeTokens", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeTokens" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 766, - "column": 2, - "index": 20783 - }, - "end": { - "line": 798, - "column": 3, - "index": 21711 - } - }, - "context": { - "loc": { - "start": { - "line": 799, - "column": 2, - "index": 21714 - }, - "end": { - "line": 827, - "column": 3, - "index": 22666 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "trim", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "trim", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#trim" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "removeColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "columnName (string) or ID (number)", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 829, - "column": 2, - "index": 22670 - }, - "end": { - "line": 864, - "column": 3, - "index": 23691 - } - }, - "context": { - "loc": { - "start": { - "line": 865, - "column": 2, - "index": 23694 - }, - "end": { - "line": 888, - "column": 3, - "index": 24362 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "c", - "lineNumber": 865 - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or ID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 890, - "column": 2, - "index": 24366 - }, - "end": { - "line": 932, - "column": 3, - "index": 25518 - } - }, - "context": { - "loc": { - "start": { - "line": 933, - "column": 2, - "index": 25521 - }, - "end": { - "line": 935, - "column": 3, - "index": 25590 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "set", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "set", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#set" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 937, - "column": 2, - "index": 25594 - }, - "end": { - "line": 976, - "column": 3, - "index": 26578 - } - }, - "context": { - "loc": { - "start": { - "line": 977, - "column": 2, - "index": 26581 - }, - "end": { - "line": 979, - "column": 3, - "index": 26656 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 981, - "column": 2, - "index": 26660 - }, - "end": { - "line": 1019, - "column": 3, - "index": 27767 - } - }, - "context": { - "loc": { - "start": { - "line": 1020, - "column": 2, - "index": 27770 - }, - "end": { - "line": 1022, - "column": 3, - "index": 27851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1024, - "column": 2, - "index": 27855 - }, - "end": { - "line": 1062, - "column": 3, - "index": 28842 - } - }, - "context": { - "loc": { - "start": { - "line": 1063, - "column": 2, - "index": 28845 - }, - "end": { - "line": 1065, - "column": 3, - "index": 28907 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "get", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "get", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#get" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1067, - "column": 2, - "index": 28911 - }, - "end": { - "line": 1103, - "column": 3, - "index": 29853 - } - }, - "context": { - "loc": { - "start": { - "line": 1104, - "column": 2, - "index": 29856 - }, - "end": { - "line": 1106, - "column": 3, - "index": 29924 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1108, - "column": 2, - "index": 29928 - }, - "end": { - "line": 1151, - "column": 3, - "index": 31214 - } - }, - "context": { - "loc": { - "start": { - "line": 1153, - "column": 2, - "index": 31218 - }, - "end": { - "line": 1155, - "column": 3, - "index": 31292 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Name of the column which should be used to\n title each row object (optional)", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "headerColumn" - }, - { - "title": "return", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 1157, - "column": 2, - "index": 31296 - }, - "end": { - "line": 1195, - "column": 3, - "index": 32265 - } - }, - "context": { - "loc": { - "start": { - "line": 1196, - "column": 2, - "index": 32268 - }, - "end": { - "line": 1216, - "column": 3, - "index": 32851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "headerColumn", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Name of the column which should be used to\ntitle each row object (optional)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getObject", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getObject", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getObject" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all table data and returns it as a multidimensional array." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 1218, - "column": 2, - "index": 32855 - }, - "end": { - "line": 1251, - "column": 3, - "index": 33622 - } - }, - "context": { - "loc": { - "start": { - "line": 1252, - "column": 2, - "index": 33625 - }, - "end": { - "line": 1258, - "column": 3, - "index": 33788 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getArray", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getArray" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - } - ], - "namespace": "p5.Table" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An internal class to store data that will be sent to a p5.RenderBuffer.\nThose need to eventually go into a Float32Array, so this class provides a\nvariable-length array container backed by a Float32Array so that it can be\nsent to the GPU without allocating a new array each frame." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Like a C++ vector, its fixed-length Float32Array backing its contents will\ndouble in size when it goes over its capacity." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 3, - "column": 0, - "index": 32 - }, - "end": { - "line": 27, - "column": 3, - "index": 926 - } - }, - "context": { - "loc": { - "start": { - "line": 28, - "column": 0, - "index": 927 - }, - "end": { - "line": 108, - "column": 2, - "index": 2998 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "DataArray", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a Float32Array window sized to the exact length of the data" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 35, - "column": 2, - "index": 1114 - }, - "end": { - "line": 37, - "column": 5, - "index": 1196 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 2, - "index": 1199 - }, - "end": { - "line": 40, - "column": 3, - "index": 1258 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dataArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "dataArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#dataArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A \"soft\" clear, which keeps the underlying storage size the same, but\nempties the contents of its dataArray()" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 42, - "column": 2, - "index": 1262 - }, - "end": { - "line": 45, - "column": 5, - "index": 1391 - } - }, - "context": { - "loc": { - "start": { - "line": 46, - "column": 2, - "index": 1394 - }, - "end": { - "line": 48, - "column": 3, - "index": 1428 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clear", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "clear", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#clear" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Can be used to scale a DataArray back down to fit its contents." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 50, - "column": 2, - "index": 1432 - }, - "end": { - "line": 52, - "column": 5, - "index": 1510 - } - }, - "context": { - "loc": { - "start": { - "line": 53, - "column": 2, - "index": 1513 - }, - "end": { - "line": 61, - "column": 3, - "index": 1839 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rescale", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "rescale", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#rescale" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A full reset, which allocates a new underlying Float32Array at its initial\nlength" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 63, - "column": 2, - "index": 1843 - }, - "end": { - "line": 66, - "column": 5, - "index": 1944 - } - }, - "context": { - "loc": { - "start": { - "line": 67, - "column": 2, - "index": 1947 - }, - "end": { - "line": 70, - "column": 3, - "index": 2032 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "reset", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "reset", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#reset" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Adds values to the DataArray, expanding its internal storage to\naccommodate the new items." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 72, - "column": 2, - "index": 2036 - }, - "end": { - "line": 75, - "column": 5, - "index": 2146 - } - }, - "context": { - "loc": { - "start": { - "line": 76, - "column": 2, - "index": 2149 - }, - "end": { - "line": 80, - "column": 3, - "index": 2296 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "values", - "lineNumber": 76, - "type": { - "type": "RestType" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "push", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "push", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#push" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a copy of the data from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to the index\n" - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 82, - "column": 2, - "index": 2300 - }, - "end": { - "line": 85, - "column": 5, - "index": 2409 - } - }, - "context": { - "loc": { - "start": { - "line": 86, - "column": 2, - "index": 2412 - }, - "end": { - "line": 88, - "column": 3, - "index": 2494 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 86 - }, - { - "title": "param", - "name": "to", - "lineNumber": 86 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "slice", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "slice", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#slice" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a mutable Float32Array window from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to\nthe index " - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 90, - "column": 2, - "index": 2498 - }, - "end": { - "line": 93, - "column": 5, - "index": 2618 - } - }, - "context": { - "loc": { - "start": { - "line": 94, - "column": 2, - "index": 2621 - }, - "end": { - "line": 96, - "column": 3, - "index": 2709 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 94 - }, - { - "title": "param", - "name": "to", - "lineNumber": 94 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "subArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "subArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#subArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Expand capacity of the internal storage until it can fit a target size" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 98, - "column": 2, - "index": 2713 - }, - "end": { - "line": 100, - "column": 5, - "index": 2798 - } - }, - "context": { - "loc": { - "start": { - "line": 101, - "column": 2, - "index": 2801 - }, - "end": { - "line": 107, - "column": 3, - "index": 2995 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "target", - "lineNumber": 101 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "ensureLength", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "ensureLength", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#ensureLength" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - } - ], - "namespace": "p5.DataArray" - } - ] - }, - "path": [ - { - "name": "p5" - } - ], - "namespace": "p5" - }, - { - "description": "", - "tags": [ - { - "title": "for", - "description": "p5", - "lineNumber": 1 - }, - { - "title": "requires", - "description": null, - "lineNumber": 2, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 4, - "column": 3, - "index": 36 - } - }, - "context": { - "loc": { - "start": { - "line": 6, - "column": 0, - "index": 38 - }, - "end": { - "line": 6, - "column": 25, - "index": 63 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/friendly_errors/sketch_reader.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "p5", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the number of frames drawn since the sketch started." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "frameCount" - }, - { - "type": "text", - "value": "'s value is 0 inside " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". It\nincrements by 1 each time the code in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfinishes executing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "frameCount" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 69, - "column": 0, - "index": 1553 - }, - "end": { - "line": 116, - "column": 3, - "index": 2581 - } - }, - "context": { - "loc": { - "start": { - "line": 117, - "column": 0, - "index": 2582 - }, - "end": { - "line": 117, - "column": 28, - "index": 2610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "frameCount", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "frameCount", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "frameCount", - "scope": "instance" - } - ], - "namespace": "p5#frameCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the amount of time, in milliseconds, it took for\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to draw the previous frame. " - }, - { - "type": "inlineCode", - "value": "deltaTime" - }, - { - "type": "text", - "value": " is\nuseful for simulating physics." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "deltaTime" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 2612 - }, - "end": { - "line": 161, - "column": 3, - "index": 3539 - } - }, - "context": { - "loc": { - "start": { - "line": 162, - "column": 0, - "index": 3540 - }, - "end": { - "line": 162, - "column": 27, - "index": 3567 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deltaTime", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deltaTime", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deltaTime", - "scope": "instance" - } - ], - "namespace": "p5#deltaTime" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks whether the browser window is focused and can receive user input.\n" - }, - { - "type": "inlineCode", - "value": "focused" - }, - { - "type": "text", - "value": " is " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": " if the window if focused and " - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "focused" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 164, - "column": 0, - "index": 3569 - }, - "end": { - "line": 190, - "column": 3, - "index": 4257 - } - }, - "context": { - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 4258 - }, - "end": { - "line": 191, - "column": 43, - "index": 4301 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "focused", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "focused", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "focused", - "scope": "instance" - } - ], - "namespace": "p5#focused" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A string variable with the WebGL version in use. Its value equals one of\nthe followin string constants:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL2" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl2'" - }, - { - "type": "text", - "value": "," - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl'" - }, - { - "type": "text", - "value": ", or" - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "P2D" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'p2d'" - }, - { - "type": "text", - "value": ". This is the default for 2D sketches." - } - ] - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setAttributes()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for ways to set the\nWebGL version." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - }, - "name": "webglVersion" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 12 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 466, - "column": 0, - "index": 12055 - }, - "end": { - "line": 544, - "column": 3, - "index": 13784 - } - }, - "context": { - "loc": { - "start": { - "line": 545, - "column": 0, - "index": 13785 - }, - "end": { - "line": 545, - "column": 34, - "index": 13819 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "webglVersion", - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "webglVersion", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "webglVersion", - "scope": "instance" - } - ], - "namespace": "p5#webglVersion" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayWidth" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen width can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayWidth * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 547, - "column": 0, - "index": 13821 - }, - "end": { - "line": 574, - "column": 3, - "index": 14559 - } - }, - "context": { - "loc": { - "start": { - "line": 575, - "column": 0, - "index": 14560 - }, - "end": { - "line": 575, - "column": 41, - "index": 14601 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayWidth", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayWidth", - "scope": "instance" - } - ], - "namespace": "p5#displayWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayHeight" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen height can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayHeight * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 577, - "column": 0, - "index": 14603 - }, - "end": { - "line": 604, - "column": 3, - "index": 15346 - } - }, - "context": { - "loc": { - "start": { - "line": 605, - "column": 0, - "index": 15347 - }, - "end": { - "line": 605, - "column": 43, - "index": 15390 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayHeight", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayHeight", - "scope": "instance" - } - ], - "namespace": "p5#displayHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 607, - "column": 0, - "index": 15392 - }, - "end": { - "line": 631, - "column": 3, - "index": 16081 - } - }, - "context": { - "loc": { - "start": { - "line": 632, - "column": 0, - "index": 16082 - }, - "end": { - "line": 632, - "column": 44, - "index": 16126 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowWidth", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowWidth", - "scope": "instance" - } - ], - "namespace": "p5#windowWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 634, - "column": 0, - "index": 16128 - }, - "end": { - "line": 658, - "column": 3, - "index": 16819 - } - }, - "context": { - "loc": { - "start": { - "line": 659, - "column": 0, - "index": 16820 - }, - "end": { - "line": 659, - "column": 46, - "index": 16866 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowHeight", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowHeight", - "scope": "instance" - } - ], - "namespace": "p5#windowHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "width" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "width" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 750, - "column": 0, - "index": 19217 - }, - "end": { - "line": 816, - "column": 3, - "index": 20713 - } - }, - "context": { - "loc": { - "start": { - "line": 817, - "column": 0, - "index": 20714 - }, - "end": { - "line": 817, - "column": 23, - "index": 20737 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "width", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "width", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "width", - "scope": "instance" - } - ], - "namespace": "p5#width" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "height" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "height" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 819, - "column": 0, - "index": 20739 - }, - "end": { - "line": 885, - "column": 3, - "index": 22246 - } - }, - "context": { - "loc": { - "start": { - "line": 886, - "column": 0, - "index": 22247 - }, - "end": { - "line": 886, - "column": 24, - "index": 22271 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "height", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "height", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "height", - "scope": "instance" - } - ], - "namespace": "p5#height" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "nothing displayed", - "lineNumber": 20 - } - ], - "loc": { - "start": { - "line": 317, - "column": 4, - "index": 10982 - }, - "end": { - "line": 340, - "column": 7, - "index": 11811 - } - }, - "context": { - "loc": { - "start": { - "line": 341, - "column": 4, - "index": 11816 - }, - "end": { - "line": 402, - "column": 6, - "index": 13726 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "remove", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "remove", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#remove" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function does 3 things:" - } - ] - }, - { - "type": "list", - "ordered": true, - "start": 1, - "spread": true, - "children": [ - { - "type": "listItem", - "spread": true, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Bounds the desired start/stop angles for an arc (in radians) so that:" - } - ] - }, - { - "type": "code", - "lang": null, - "meta": null, - "value": "0 <= start < TWO_PI ; start <= stop < start + TWO_PI" - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This means that the arc rendering functions don't have to be concerned\nwith what happens if stop is smaller than start, or if the arc 'goes\nround more than once', etc.: they can just start at start and increase\nuntil stop and the correct arc will be drawn." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Optionally adjusts the angles within each quadrant to counter the naive\nscaling of the underlying ellipse up from the unit circle. Without\nthis, the angles become arbitrary when width != height: 45 degrees\nmight be drawn at 5 degrees on a 'wide' ellipse, or at 85 degrees on\na 'tall' ellipse." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Flags up when start and stop correspond to the same place on the\nunderlying ellipse. This is useful if you want to do something special\nthere (like rendering a whole ellipse instead)." - } - ] - } - ] - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 16, - "column": 0, - "index": 333 - }, - "end": { - "line": 37, - "column": 3, - "index": 1365 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 1366 - }, - "end": { - "line": 100, - "column": 2, - "index": 3623 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "start", - "lineNumber": 39 - }, - { - "title": "param", - "name": "stop", - "lineNumber": 40 - }, - { - "title": "param", - "name": "width", - "lineNumber": 41 - }, - { - "title": "param", - "name": "height", - "lineNumber": 42 - }, - { - "title": "param", - "name": "correctForScaling", - "lineNumber": 43 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_normalizeArcAngles", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_normalizeArcAngles", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_normalizeArcAngles" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for select and selectAll" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 6392 - }, - "end": { - "line": 193, - "column": 3, - "index": 6443 - } - }, - "context": { - "loc": { - "start": { - "line": 194, - "column": 0, - "index": 6444 - }, - "end": { - "line": 204, - "column": 2, - "index": 6751 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "p", - "lineNumber": 194 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_getContainer", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_getContainer", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_getContainer" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for getElement and getElements." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 206, - "column": 0, - "index": 6753 - }, - "end": { - "line": 208, - "column": 3, - "index": 6811 - } - }, - "context": { - "loc": { - "start": { - "line": 209, - "column": 0, - "index": 6812 - }, - "end": { - "line": 238, - "column": 2, - "index": 7767 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "elt", - "lineNumber": 209 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_wrapElement", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_wrapElement", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_wrapElement" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "INPUT *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 715, - "column": 0, - "index": 21883 - }, - "end": { - "line": 715, - "column": 13, - "index": 21896 - } - }, - "context": { - "loc": { - "start": { - "line": 827, - "column": 0, - "index": 24953 - }, - "end": { - "line": 840, - "column": 2, - "index": 25384 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "min", - "lineNumber": 827 - }, - { - "title": "param", - "name": "max", - "lineNumber": 827 - }, - { - "title": "param", - "name": "value", - "lineNumber": 827 - }, - { - "title": "param", - "name": "step", - "lineNumber": 827 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createSlider", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createSlider", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createSlider" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "AUDIO STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2041, - "column": 0, - "index": 61417 - }, - "end": { - "line": 2041, - "column": 19, - "index": 61436 - } - }, - "context": { - "loc": { - "start": { - "line": 2080, - "column": 0, - "index": 62975 - }, - "end": { - "line": 2083, - "column": 2, - "index": 63135 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "src", - "lineNumber": 2080 - }, - { - "title": "param", - "name": "callback", - "lineNumber": 2080 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createAudio", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createAudio", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createAudio" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "CAMERA STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2085, - "column": 0, - "index": 63137 - }, - "end": { - "line": 2085, - "column": 20, - "index": 63157 - } - }, - "context": { - "loc": { - "start": { - "line": 2087, - "column": 0, - "index": 63159 - }, - "end": { - "line": 2087, - "column": 29, - "index": 63188 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "VIDEO", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "VIDEO", - "scope": "instance" - } - ], - "namespace": "p5#VIDEO" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - }, - "name": "deviceOrientation" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 20, - "column": 3, - "index": 511 - } - }, - "context": { - "loc": { - "start": { - "line": 21, - "column": 0, - "index": 512 - }, - "end": { - "line": 22, - "column": 74, - "index": 619 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deviceOrientation", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deviceOrientation", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deviceOrientation", - "scope": "instance" - } - ], - "namespace": "p5#deviceOrientation" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationX always contains the acceleration of the\ndevice along the x axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 24, - "column": 0, - "index": 621 - }, - "end": { - "line": 43, - "column": 3, - "index": 1167 - } - }, - "context": { - "loc": { - "start": { - "line": 44, - "column": 0, - "index": 1168 - }, - "end": { - "line": 44, - "column": 31, - "index": 1199 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationX", - "scope": "instance" - } - ], - "namespace": "p5#accelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationY always contains the acceleration of the\ndevice along the y axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 46, - "column": 0, - "index": 1201 - }, - "end": { - "line": 65, - "column": 3, - "index": 1746 - } - }, - "context": { - "loc": { - "start": { - "line": 66, - "column": 0, - "index": 1747 - }, - "end": { - "line": 66, - "column": 31, - "index": 1778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationY", - "scope": "instance" - } - ], - "namespace": "p5#accelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationZ always contains the acceleration of the\ndevice along the z axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 68, - "column": 0, - "index": 1780 - }, - "end": { - "line": 88, - "column": 3, - "index": 2328 - } - }, - "context": { - "loc": { - "start": { - "line": 89, - "column": 0, - "index": 2329 - }, - "end": { - "line": 89, - "column": 31, - "index": 2360 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationZ", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#accelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 91, - "column": 0, - "index": 2362 - }, - "end": { - "line": 98, - "column": 3, - "index": 2625 - } - }, - "context": { - "loc": { - "start": { - "line": 99, - "column": 0, - "index": 2626 - }, - "end": { - "line": 99, - "column": 32, - "index": 2658 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationX", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationX", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 101, - "column": 0, - "index": 2660 - }, - "end": { - "line": 108, - "column": 3, - "index": 2923 - } - }, - "context": { - "loc": { - "start": { - "line": 109, - "column": 0, - "index": 2924 - }, - "end": { - "line": 109, - "column": 32, - "index": 2956 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationY", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationY", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 111, - "column": 0, - "index": 2958 - }, - "end": { - "line": 118, - "column": 3, - "index": 3221 - } - }, - "context": { - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 3222 - }, - "end": { - "line": 119, - "column": 32, - "index": 3254 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationZ", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationX always contains the rotation of the\ndevice along the x axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES, the value will be -180 to 180. If\nit is set to RADIANS, the value will be -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 132, - "column": 0, - "index": 3568 - }, - "end": { - "line": 162, - "column": 3, - "index": 4447 - } - }, - "context": { - "loc": { - "start": { - "line": 163, - "column": 0, - "index": 4448 - }, - "end": { - "line": 163, - "column": 27, - "index": 4475 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationX", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationX", - "scope": "instance" - } - ], - "namespace": "p5#rotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationY always contains the rotation of the\ndevice along the y axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 165, - "column": 0, - "index": 4477 - }, - "end": { - "line": 195, - "column": 3, - "index": 5358 - } - }, - "context": { - "loc": { - "start": { - "line": 196, - "column": 0, - "index": 5359 - }, - "end": { - "line": 196, - "column": 27, - "index": 5386 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationY", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationY", - "scope": "instance" - } - ], - "namespace": "p5#rotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationZ always contains the rotation of the\ndevice along the z axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Unlike rotationX and rotationY, this variable is available for devices\nwith a built-in compass only." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - }, - { - "title": "property", - "description": null, - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 33 - } - ], - "loc": { - "start": { - "line": 198, - "column": 0, - "index": 5388 - }, - "end": { - "line": 232, - "column": 3, - "index": 6377 - } - }, - "context": { - "loc": { - "start": { - "line": 233, - "column": 0, - "index": 6378 - }, - "end": { - "line": 233, - "column": 27, - "index": 6405 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationZ", - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationZ", - "scope": "instance" - } - ], - "namespace": "p5#rotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES,\nthe value will be -180 to 180. If it is set to RADIANS, the value will\nbe -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationX can also be used with rotationX to determine the rotate\ndirection of the device along the X-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 40 - } - ], - "loc": { - "start": { - "line": 235, - "column": 0, - "index": 6407 - }, - "end": { - "line": 276, - "column": 3, - "index": 7745 - } - }, - "context": { - "loc": { - "start": { - "line": 277, - "column": 0, - "index": 7746 - }, - "end": { - "line": 277, - "column": 28, - "index": 7774 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationX", - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationX", - "scope": "instance" - } - ], - "namespace": "p5#pRotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationY can also be used with rotationY to determine the rotate\ndirection of the device along the Y-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 39 - } - ], - "loc": { - "start": { - "line": 279, - "column": 0, - "index": 7776 - }, - "end": { - "line": 319, - "column": 3, - "index": 9113 - } - }, - "context": { - "loc": { - "start": { - "line": 320, - "column": 0, - "index": 9114 - }, - "end": { - "line": 320, - "column": 28, - "index": 9142 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationY", - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationY", - "scope": "instance" - } - ], - "namespace": "p5#pRotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationZ can also be used with rotationZ to determine the rotate\ndirection of the device along the Z-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 35 - } - ], - "loc": { - "start": { - "line": 322, - "column": 0, - "index": 9144 - }, - "end": { - "line": 358, - "column": 3, - "index": 10350 - } - }, - "context": { - "loc": { - "start": { - "line": 359, - "column": 0, - "index": 10351 - }, - "end": { - "line": 359, - "column": 28, - "index": 10379 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationZ", - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationZ", - "scope": "instance" - } - ], - "namespace": "p5#pRotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When a device is rotated, the axis that triggers the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "deviceTurned()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nmethod is stored in the turnAxis variable. The turnAxis variable is only defined within\nthe scope of deviceTurned()." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "turnAxis" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 379, - "column": 0, - "index": 10890 - }, - "end": { - "line": 412, - "column": 3, - "index": 11826 - } - }, - "context": { - "loc": { - "start": { - "line": 413, - "column": 0, - "index": 11827 - }, - "end": { - "line": 413, - "column": 34, - "index": 11861 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "turnAxis", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "turnAxis", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "turnAxis", - "scope": "instance" - } - ], - "namespace": "p5#turnAxis" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyIsPressed" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is true if any key is pressed\nand false if no keys are pressed." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "keyIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 111 - }, - "end": { - "line": 30, - "column": 3, - "index": 575 - } - }, - "context": { - "loc": { - "start": { - "line": 31, - "column": 0, - "index": 576 - }, - "end": { - "line": 31, - "column": 34, - "index": 610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "isKeyPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "isKeyPressed", - "scope": "instance" - } - ], - "namespace": "p5#isKeyPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyTyped()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". For non-ASCII keys, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyCode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nvariable." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "key" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 34, - "column": 0, - "index": 655 - }, - "end": { - "line": 57, - "column": 3, - "index": 1373 - } - }, - "context": { - "loc": { - "start": { - "line": 58, - "column": 0, - "index": 1374 - }, - "end": { - "line": 58, - "column": 22, - "index": 1396 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "key", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "key", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "key", - "scope": "instance" - } - ], - "namespace": "p5#key" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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: " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keycode.info" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "keyCode" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 60, - "column": 0, - "index": 1398 - }, - "end": { - "line": 95, - "column": 3, - "index": 2425 - } - }, - "context": { - "loc": { - "start": { - "line": 96, - "column": 0, - "index": 2426 - }, - "end": { - "line": 96, - "column": 25, - "index": 2451 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyCode", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "keyCode", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "keyCode", - "scope": "instance" - } - ], - "namespace": "p5#keyCode" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The onblur function is called when the user is no longer focused\non the p5 element. Because the keyup events will not fire if the user is\nnot focused on the element we must assume all keys currently down have\nbeen released." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 291, - "column": 0, - "index": 8735 - }, - "end": { - "line": 296, - "column": 3, - "index": 8978 - } - }, - "context": { - "loc": { - "start": { - "line": 297, - "column": 0, - "index": 8979 - }, - "end": { - "line": 299, - "column": 2, - "index": 9041 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "e", - "lineNumber": 297 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_onblur", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_onblur", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_onblur" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedX contains the horizontal movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 4 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 40, - "column": 3, - "index": 777 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 778 - }, - "end": { - "line": 41, - "column": 24, - "index": 802 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedX", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedX", - "scope": "instance" - } - ], - "namespace": "p5#movedX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedY contains the vertical movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 43, - "column": 0, - "index": 804 - }, - "end": { - "line": 70, - "column": 3, - "index": 1394 - } - }, - "context": { - "loc": { - "start": { - "line": 71, - "column": 0, - "index": 1395 - }, - "end": { - "line": 71, - "column": 24, - "index": 1419 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedY", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedY", - "scope": "instance" - } - ], - "namespace": "p5#movedY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 80, - "column": 0, - "index": 1666 - }, - "end": { - "line": 101, - "column": 3, - "index": 2316 - } - }, - "context": { - "loc": { - "start": { - "line": 102, - "column": 0, - "index": 2317 - }, - "end": { - "line": 102, - "column": 24, - "index": 2341 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseX", - "scope": "instance" - } - ], - "namespace": "p5#mouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 2343 - }, - "end": { - "line": 125, - "column": 3, - "index": 2986 - } - }, - "context": { - "loc": { - "start": { - "line": 126, - "column": 0, - "index": 2987 - }, - "end": { - "line": 126, - "column": 24, - "index": 3011 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseY", - "scope": "instance" - } - ], - "namespace": "p5#mouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 128, - "column": 0, - "index": 3013 - }, - "end": { - "line": 156, - "column": 3, - "index": 3890 - } - }, - "context": { - "loc": { - "start": { - "line": 157, - "column": 0, - "index": 3891 - }, - "end": { - "line": 157, - "column": 25, - "index": 3916 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseX", - "scope": "instance" - } - ], - "namespace": "p5#pmouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 159, - "column": 0, - "index": 3918 - }, - "end": { - "line": 186, - "column": 3, - "index": 4745 - } - }, - "context": { - "loc": { - "start": { - "line": 187, - "column": 0, - "index": 4746 - }, - "end": { - "line": 187, - "column": 25, - "index": 4771 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseY", - "scope": "instance" - } - ], - "namespace": "p5#pmouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseX always contains the current horizontal\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 189, - "column": 0, - "index": 4773 - }, - "end": { - "line": 223, - "column": 3, - "index": 5653 - } - }, - "context": { - "loc": { - "start": { - "line": 224, - "column": 0, - "index": 5654 - }, - "end": { - "line": 224, - "column": 27, - "index": 5681 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseX", - "scope": "instance" - } - ], - "namespace": "p5#winMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseY always contains the current vertical\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 226, - "column": 0, - "index": 5683 - }, - "end": { - "line": 260, - "column": 3, - "index": 6560 - } - }, - "context": { - "loc": { - "start": { - "line": 261, - "column": 0, - "index": 6561 - }, - "end": { - "line": 261, - "column": 27, - "index": 6588 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseY", - "scope": "instance" - } - ], - "namespace": "p5#winMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 263, - "column": 0, - "index": 6590 - }, - "end": { - "line": 299, - "column": 3, - "index": 7675 - } - }, - "context": { - "loc": { - "start": { - "line": 300, - "column": 0, - "index": 7676 - }, - "end": { - "line": 300, - "column": 28, - "index": 7704 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseX", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseX", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 302, - "column": 0, - "index": 7706 - }, - "end": { - "line": 338, - "column": 3, - "index": 8785 - } - }, - "context": { - "loc": { - "start": { - "line": 339, - "column": 0, - "index": 8786 - }, - "end": { - "line": 339, - "column": 28, - "index": 8814 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseY", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseY", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - }, - "name": "mouseButton" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 341, - "column": 0, - "index": 8816 - }, - "end": { - "line": 375, - "column": 3, - "index": 9715 - } - }, - "context": { - "loc": { - "start": { - "line": 376, - "column": 0, - "index": 9716 - }, - "end": { - "line": 376, - "column": 29, - "index": 9745 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseButton", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseButton", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseButton", - "scope": "instance" - } - ], - "namespace": "p5#mouseButton" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable mouseIsPressed is true if the mouse is pressed\nand false if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "mouseIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 378, - "column": 0, - "index": 9747 - }, - "end": { - "line": 404, - "column": 3, - "index": 10289 - } - }, - "context": { - "loc": { - "start": { - "line": 405, - "column": 0, - "index": 10290 - }, - "end": { - "line": 405, - "column": 36, - "index": 10326 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseIsPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseIsPressed", - "scope": "instance" - } - ], - "namespace": "p5#mouseIsPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The touches[] array is not supported on Safari and IE on touch-based\ndesktops (laptops)." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - }, - "name": "touches" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 108 - }, - "end": { - "line": 37, - "column": 3, - "index": 883 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 884 - }, - "end": { - "line": 38, - "column": 26, - "index": 910 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/touch.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "touches", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "touches", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "touches", - "scope": "instance" - } - ], - "namespace": "p5#touches" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An array containing the color of each pixel on the canvas. Colors are\nstored as numbers representing red, green, blue, and alpha (RGBA) values.\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " is a one-dimensional array for performance reasons." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Each pixel occupies four elements in the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array, one for each RGBA\nvalue. For example, the pixel at coordinates (0, 0) stores its RGBA values\nat " - }, - { - "type": "inlineCode", - "value": "pixels[0]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[1]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[2]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[3]" - }, - { - "type": "text", - "value": ", respectively.\nThe next pixel at coordinates (1, 0) stores its RGBA values at " - }, - { - "type": "inlineCode", - "value": "pixels[4]" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "inlineCode", - "value": "pixels[5]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[6]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[7]" - }, - { - "type": "text", - "value": ". And so on. The " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array\nfor a 100×100 canvas has 100 × 100 × 4 = 40,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Some displays use several smaller pixels to set the color at a single\npoint. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function returns\nthe pixel density of the canvas. High density displays often have a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " of 2. On such a display, the\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array for a 100×100 canvas has 200 × 200 × 4 =\n160,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Accessing the RGBA values for a point on the canvas requires a little math\nas shown below. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadPixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function\nmust be called before accessing the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array. The\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "updatePixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function must be called\nafter any changes are made." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "pixels" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 169 - }, - "end": { - "line": 103, - "column": 3, - "index": 3031 - } - }, - "context": { - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 3032 - }, - "end": { - "line": 104, - "column": 25, - "index": 3057 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pixels", - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pixels", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pixels", - "scope": "instance" - } - ], - "namespace": "p5#pixels" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function to measure ascent and descent." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 362, - "column": 0, - "index": 9474 - }, - "end": { - "line": 364, - "column": 3, - "index": 9531 - } - }, - "context": { - "loc": { - "start": { - "line": 365, - "column": 0, - "index": 9532 - }, - "end": { - "line": 367, - "column": 2, - "index": 9627 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_updateTextMetrics", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_updateTextMetrics", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_updateTextMetrics" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ensures that p5 is using a 3d renderer. throws an error if not." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2350, - "column": 0, - "index": 73393 - }, - "end": { - "line": 2352, - "column": 3, - "index": 73467 - } - }, - "context": { - "loc": { - "start": { - "line": 2353, - "column": 0, - "index": 73468 - }, - "end": { - "line": 2358, - "column": 2, - "index": 73742 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "name", - "lineNumber": 2353 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_assert3d", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_assert3d", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_assert3d" - } - ], - "events": [], - "static": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Turn off some features of the friendly error system (FES), which can give\na significant boost to performance when needed." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ndisabling the friendly error system" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "disableFriendlyErrors" - }, - { - "title": "example", - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 754, - "column": 0, - "index": 26038 - }, - "end": { - "line": 776, - "column": 3, - "index": 26889 - } - }, - "context": { - "loc": { - "start": { - "line": 777, - "column": 0, - "index": 26890 - }, - "end": { - "line": 777, - "column": 33, - "index": 26923 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "disableFriendlyErrors", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "disableFriendlyErrors", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "disableFriendlyErrors", - "scope": "static" - } - ], - "namespace": "p5.disableFriendlyErrors" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Path to the media element's source as a string." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.MediaElement", - "lineNumber": 3 - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "src" - }, - { - "title": "return", - "description": "src", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 4842, - "column": 0, - "index": 139686 - }, - "end": { - "line": 4868, - "column": 3, - "index": 140231 - } - }, - "context": { - "loc": { - "start": { - "line": 4958, - "column": 0, - "index": 142394 - }, - "end": { - "line": 5009, - "column": 2, - "index": 143967 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "src" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "File", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "File", - "scope": "static" - } - ], - "namespace": "p5.File" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Table Options\nGeneric class for handling tabular data, typically from a\nCSV, TSV, or other sort of spreadsheet file.\nCSV files are\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ncomma separated values" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", often with the data in quotes. TSV\nfiles use tabs as separators, and usually don't bother with the\nquotes.\nFile names should end with .csv if they're comma separated.\nA rough \"spec\" for CSV can be found\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "here" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nTo load files, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method.\nTo save tables to your computer, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "save" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method\nor the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "saveTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Possible options include:" - } - ] - }, - { - "type": "html", - "value": "
    \n
  • csv - parse the table as comma-separated values\n
  • tsv - parse the table as tab-separated values\n
  • header - this table has a header (title) row\n
" - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 93 - }, - "end": { - "line": 31, - "column": 3, - "index": 1053 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 1379 - }, - "end": { - "line": 1259, - "column": 2, - "index": 33791 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "Table", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addRow()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new row of data to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "set()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object is included as a parameter, then that row is\nduplicated and added to the table." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row to be added to the table", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - "name": "row" - }, - { - "title": "return", - "description": "the row that was added", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 47, - "column": 2, - "index": 1476 - }, - "end": { - "line": 94, - "column": 3, - "index": 2995 - } - }, - "context": { - "loc": { - "start": { - "line": 95, - "column": 2, - "index": 2998 - }, - "end": { - "line": 106, - "column": 3, - "index": 3319 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row to be added to the table" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the row that was added" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes a row from the table object." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to remove", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "id" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 108, - "column": 2, - "index": 3323 - }, - "end": { - "line": 145, - "column": 3, - "index": 4202 - } - }, - "context": { - "loc": { - "start": { - "line": 146, - "column": 2, - "index": 4205 - }, - "end": { - "line": 151, - "column": 3, - "index": 4410 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "id", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to remove" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a reference to the specified " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". The reference\ncan then be used to get and set values of the selected row." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to get", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "rowID" - }, - { - "title": "return", - "description": "p5.TableRow object", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 153, - "column": 2, - "index": 4414 - }, - "end": { - "line": 191, - "column": 3, - "index": 5463 - } - }, - "context": { - "loc": { - "start": { - "line": 192, - "column": 2, - "index": 5466 - }, - "end": { - "line": 194, - "column": 3, - "index": 5507 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "r", - "lineNumber": 192 - }, - { - "title": "param", - "name": "rowID", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to get" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Gets all rows from the table. Returns an array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Array of p5.TableRows", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 196, - "column": 2, - "index": 5511 - }, - "end": { - "line": 237, - "column": 3, - "index": 6588 - } - }, - "context": { - "loc": { - "start": { - "line": 238, - "column": 2, - "index": 6591 - }, - "end": { - "line": 240, - "column": 3, - "index": 6629 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 242, - "column": 2, - "index": 6633 - }, - "end": { - "line": 282, - "column": 3, - "index": 7805 - } - }, - "context": { - "loc": { - "start": { - "line": 283, - "column": 2, - "index": 7808 - }, - "end": { - "line": 301, - "column": 3, - "index": 8272 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 10, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 303, - "column": 2, - "index": 8276 - }, - "end": { - "line": 348, - "column": 3, - "index": 9683 - } - }, - "context": { - "loc": { - "start": { - "line": 349, - "column": 2, - "index": 9686 - }, - "end": { - "line": 366, - "column": 3, - "index": 10136 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "TableRow object", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 368, - "column": 2, - "index": 10140 - }, - "end": { - "line": 407, - "column": 3, - "index": 11362 - } - }, - "context": { - "loc": { - "start": { - "line": 408, - "column": 2, - "index": 11365 - }, - "end": { - "line": 423, - "column": 3, - "index": 11778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "TableRow object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 425, - "column": 2, - "index": 11782 - }, - "end": { - "line": 472, - "column": 3, - "index": 13226 - } - }, - "context": { - "loc": { - "start": { - "line": 473, - "column": 2, - "index": 13229 - }, - "end": { - "line": 489, - "column": 3, - "index": 13668 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all values in the specified column, and returns them\nas an array. The column may be specified by either its ID or title." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String or Number of the column to return", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "Array of column values", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 491, - "column": 2, - "index": 13672 - }, - "end": { - "line": 525, - "column": 3, - "index": 14658 - } - }, - "context": { - "loc": { - "start": { - "line": 526, - "column": 2, - "index": 14661 - }, - "end": { - "line": 538, - "column": 3, - "index": 14980 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 526 - }, - { - "title": "param", - "name": "column", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String or Number of the column to return" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of column values" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes all rows from a Table. While all rows are removed,\ncolumns and column titles are maintained." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 540, - "column": 2, - "index": 14984 - }, - "end": { - "line": 571, - "column": 3, - "index": 15789 - } - }, - "context": { - "loc": { - "start": { - "line": 572, - "column": 2, - "index": 15792 - }, - "end": { - "line": 575, - "column": 3, - "index": 15852 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clearRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "clearRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#clearRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new column to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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.)" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "title of the given column", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "title" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 577, - "column": 2, - "index": 15856 - }, - "end": { - "line": 619, - "column": 3, - "index": 17079 - } - }, - "context": { - "loc": { - "start": { - "line": 620, - "column": 2, - "index": 17082 - }, - "end": { - "line": 623, - "column": 3, - "index": 17160 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "title", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "title of the given column" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of columns in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of columns in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 625, - "column": 2, - "index": 17164 - }, - "end": { - "line": 655, - "column": 3, - "index": 17854 - } - }, - "context": { - "loc": { - "start": { - "line": 656, - "column": 2, - "index": 17857 - }, - "end": { - "line": 658, - "column": 3, - "index": 17912 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of columns in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumnCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumnCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumnCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of rows in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of rows in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 660, - "column": 2, - "index": 17916 - }, - "end": { - "line": 690, - "column": 3, - "index": 18564 - } - }, - "context": { - "loc": { - "start": { - "line": 691, - "column": 2, - "index": 18567 - }, - "end": { - "line": 693, - "column": 3, - "index": 18616 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of rows in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRowCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRowCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRowCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes any of the specified characters (or \"tokens\")." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String listing characters to be removed", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "chars" - }, - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 695, - "column": 2, - "index": 18620 - }, - "end": { - "line": 730, - "column": 3, - "index": 19601 - } - }, - "context": { - "loc": { - "start": { - "line": 731, - "column": 2, - "index": 19604 - }, - "end": { - "line": 764, - "column": 3, - "index": 20779 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "chars", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String listing characters to be removed" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeTokens", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeTokens", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeTokens" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 766, - "column": 2, - "index": 20783 - }, - "end": { - "line": 798, - "column": 3, - "index": 21711 - } - }, - "context": { - "loc": { - "start": { - "line": 799, - "column": 2, - "index": 21714 - }, - "end": { - "line": 827, - "column": 3, - "index": 22666 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "trim", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "trim", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#trim" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "removeColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "columnName (string) or ID (number)", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 829, - "column": 2, - "index": 22670 - }, - "end": { - "line": 864, - "column": 3, - "index": 23691 - } - }, - "context": { - "loc": { - "start": { - "line": 865, - "column": 2, - "index": 23694 - }, - "end": { - "line": 888, - "column": 3, - "index": 24362 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "c", - "lineNumber": 865 - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or ID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 890, - "column": 2, - "index": 24366 - }, - "end": { - "line": 932, - "column": 3, - "index": 25518 - } - }, - "context": { - "loc": { - "start": { - "line": 933, - "column": 2, - "index": 25521 - }, - "end": { - "line": 935, - "column": 3, - "index": 25590 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "set", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "set", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#set" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 937, - "column": 2, - "index": 25594 - }, - "end": { - "line": 976, - "column": 3, - "index": 26578 - } - }, - "context": { - "loc": { - "start": { - "line": 977, - "column": 2, - "index": 26581 - }, - "end": { - "line": 979, - "column": 3, - "index": 26656 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 981, - "column": 2, - "index": 26660 - }, - "end": { - "line": 1019, - "column": 3, - "index": 27767 - } - }, - "context": { - "loc": { - "start": { - "line": 1020, - "column": 2, - "index": 27770 - }, - "end": { - "line": 1022, - "column": 3, - "index": 27851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1024, - "column": 2, - "index": 27855 - }, - "end": { - "line": 1062, - "column": 3, - "index": 28842 - } - }, - "context": { - "loc": { - "start": { - "line": 1063, - "column": 2, - "index": 28845 - }, - "end": { - "line": 1065, - "column": 3, - "index": 28907 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "get", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "get", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#get" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1067, - "column": 2, - "index": 28911 - }, - "end": { - "line": 1103, - "column": 3, - "index": 29853 - } - }, - "context": { - "loc": { - "start": { - "line": 1104, - "column": 2, - "index": 29856 - }, - "end": { - "line": 1106, - "column": 3, - "index": 29924 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1108, - "column": 2, - "index": 29928 - }, - "end": { - "line": 1151, - "column": 3, - "index": 31214 - } - }, - "context": { - "loc": { - "start": { - "line": 1153, - "column": 2, - "index": 31218 - }, - "end": { - "line": 1155, - "column": 3, - "index": 31292 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Name of the column which should be used to\n title each row object (optional)", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "headerColumn" - }, - { - "title": "return", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 1157, - "column": 2, - "index": 31296 - }, - "end": { - "line": 1195, - "column": 3, - "index": 32265 - } - }, - "context": { - "loc": { - "start": { - "line": 1196, - "column": 2, - "index": 32268 - }, - "end": { - "line": 1216, - "column": 3, - "index": 32851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "headerColumn", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Name of the column which should be used to\ntitle each row object (optional)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getObject", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getObject", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getObject" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all table data and returns it as a multidimensional array." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 1218, - "column": 2, - "index": 32855 - }, - "end": { - "line": 1251, - "column": 3, - "index": 33622 - } - }, - "context": { - "loc": { - "start": { - "line": 1252, - "column": 2, - "index": 33625 - }, - "end": { - "line": 1258, - "column": 3, - "index": 33788 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getArray", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getArray" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - } - ], - "namespace": "p5.Table" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An internal class to store data that will be sent to a p5.RenderBuffer.\nThose need to eventually go into a Float32Array, so this class provides a\nvariable-length array container backed by a Float32Array so that it can be\nsent to the GPU without allocating a new array each frame." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Like a C++ vector, its fixed-length Float32Array backing its contents will\ndouble in size when it goes over its capacity." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 3, - "column": 0, - "index": 32 - }, - "end": { - "line": 27, - "column": 3, - "index": 926 - } - }, - "context": { - "loc": { - "start": { - "line": 28, - "column": 0, - "index": 927 - }, - "end": { - "line": 108, - "column": 2, - "index": 2998 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "DataArray", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a Float32Array window sized to the exact length of the data" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 35, - "column": 2, - "index": 1114 - }, - "end": { - "line": 37, - "column": 5, - "index": 1196 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 2, - "index": 1199 - }, - "end": { - "line": 40, - "column": 3, - "index": 1258 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dataArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "dataArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#dataArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A \"soft\" clear, which keeps the underlying storage size the same, but\nempties the contents of its dataArray()" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 42, - "column": 2, - "index": 1262 - }, - "end": { - "line": 45, - "column": 5, - "index": 1391 - } - }, - "context": { - "loc": { - "start": { - "line": 46, - "column": 2, - "index": 1394 - }, - "end": { - "line": 48, - "column": 3, - "index": 1428 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clear", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "clear", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#clear" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Can be used to scale a DataArray back down to fit its contents." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 50, - "column": 2, - "index": 1432 - }, - "end": { - "line": 52, - "column": 5, - "index": 1510 - } - }, - "context": { - "loc": { - "start": { - "line": 53, - "column": 2, - "index": 1513 - }, - "end": { - "line": 61, - "column": 3, - "index": 1839 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rescale", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "rescale", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#rescale" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A full reset, which allocates a new underlying Float32Array at its initial\nlength" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 63, - "column": 2, - "index": 1843 - }, - "end": { - "line": 66, - "column": 5, - "index": 1944 - } - }, - "context": { - "loc": { - "start": { - "line": 67, - "column": 2, - "index": 1947 - }, - "end": { - "line": 70, - "column": 3, - "index": 2032 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "reset", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "reset", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#reset" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Adds values to the DataArray, expanding its internal storage to\naccommodate the new items." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 72, - "column": 2, - "index": 2036 - }, - "end": { - "line": 75, - "column": 5, - "index": 2146 - } - }, - "context": { - "loc": { - "start": { - "line": 76, - "column": 2, - "index": 2149 - }, - "end": { - "line": 80, - "column": 3, - "index": 2296 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "values", - "lineNumber": 76, - "type": { - "type": "RestType" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "push", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "push", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#push" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a copy of the data from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to the index\n" - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 82, - "column": 2, - "index": 2300 - }, - "end": { - "line": 85, - "column": 5, - "index": 2409 - } - }, - "context": { - "loc": { - "start": { - "line": 86, - "column": 2, - "index": 2412 - }, - "end": { - "line": 88, - "column": 3, - "index": 2494 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 86 - }, - { - "title": "param", - "name": "to", - "lineNumber": 86 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "slice", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "slice", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#slice" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a mutable Float32Array window from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to\nthe index " - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 90, - "column": 2, - "index": 2498 - }, - "end": { - "line": 93, - "column": 5, - "index": 2618 - } - }, - "context": { - "loc": { - "start": { - "line": 94, - "column": 2, - "index": 2621 - }, - "end": { - "line": 96, - "column": 3, - "index": 2709 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 94 - }, - { - "title": "param", - "name": "to", - "lineNumber": 94 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "subArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "subArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#subArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Expand capacity of the internal storage until it can fit a target size" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 98, - "column": 2, - "index": 2713 - }, - "end": { - "line": 100, - "column": 5, - "index": 2798 - } - }, - "context": { - "loc": { - "start": { - "line": 101, - "column": 2, - "index": 2801 - }, - "end": { - "line": 107, - "column": 3, - "index": 2995 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "target", - "lineNumber": 101 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "ensureLength", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "ensureLength", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#ensureLength" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - } - ], - "namespace": "p5.DataArray" - } - ] - }, - "path": [ - { - "name": "p5" - } - ], - "namespace": "p5" - }, - { - "description": "", - "tags": [ - { - "title": "for", - "description": "p5", - "lineNumber": 1 - }, - { - "title": "requires", - "description": null, - "lineNumber": 2, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 4, - "column": 3, - "index": 36 - } - }, - "context": { - "loc": { - "start": { - "line": 5, - "column": 0, - "index": 37 - }, - "end": { - "line": 5, - "column": 25, - "index": 62 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/friendly_errors/stacktrace.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "p5", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the number of frames drawn since the sketch started." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "frameCount" - }, - { - "type": "text", - "value": "'s value is 0 inside " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". It\nincrements by 1 each time the code in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfinishes executing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "frameCount" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 69, - "column": 0, - "index": 1553 - }, - "end": { - "line": 116, - "column": 3, - "index": 2581 - } - }, - "context": { - "loc": { - "start": { - "line": 117, - "column": 0, - "index": 2582 - }, - "end": { - "line": 117, - "column": 28, - "index": 2610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "frameCount", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "frameCount", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "frameCount", - "scope": "instance" - } - ], - "namespace": "p5#frameCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the amount of time, in milliseconds, it took for\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to draw the previous frame. " - }, - { - "type": "inlineCode", - "value": "deltaTime" - }, - { - "type": "text", - "value": " is\nuseful for simulating physics." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "deltaTime" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 2612 - }, - "end": { - "line": 161, - "column": 3, - "index": 3539 - } - }, - "context": { - "loc": { - "start": { - "line": 162, - "column": 0, - "index": 3540 - }, - "end": { - "line": 162, - "column": 27, - "index": 3567 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deltaTime", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deltaTime", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deltaTime", - "scope": "instance" - } - ], - "namespace": "p5#deltaTime" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks whether the browser window is focused and can receive user input.\n" - }, - { - "type": "inlineCode", - "value": "focused" - }, - { - "type": "text", - "value": " is " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": " if the window if focused and " - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "focused" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 164, - "column": 0, - "index": 3569 - }, - "end": { - "line": 190, - "column": 3, - "index": 4257 - } - }, - "context": { - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 4258 - }, - "end": { - "line": 191, - "column": 43, - "index": 4301 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "focused", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "focused", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "focused", - "scope": "instance" - } - ], - "namespace": "p5#focused" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A string variable with the WebGL version in use. Its value equals one of\nthe followin string constants:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL2" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl2'" - }, - { - "type": "text", - "value": "," - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl'" - }, - { - "type": "text", - "value": ", or" - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "P2D" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'p2d'" - }, - { - "type": "text", - "value": ". This is the default for 2D sketches." - } - ] - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setAttributes()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for ways to set the\nWebGL version." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - }, - "name": "webglVersion" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 12 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 466, - "column": 0, - "index": 12055 - }, - "end": { - "line": 544, - "column": 3, - "index": 13784 - } - }, - "context": { - "loc": { - "start": { - "line": 545, - "column": 0, - "index": 13785 - }, - "end": { - "line": 545, - "column": 34, - "index": 13819 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "webglVersion", - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "webglVersion", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "webglVersion", - "scope": "instance" - } - ], - "namespace": "p5#webglVersion" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayWidth" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen width can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayWidth * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 547, - "column": 0, - "index": 13821 - }, - "end": { - "line": 574, - "column": 3, - "index": 14559 - } - }, - "context": { - "loc": { - "start": { - "line": 575, - "column": 0, - "index": 14560 - }, - "end": { - "line": 575, - "column": 41, - "index": 14601 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayWidth", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayWidth", - "scope": "instance" - } - ], - "namespace": "p5#displayWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayHeight" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen height can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayHeight * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 577, - "column": 0, - "index": 14603 - }, - "end": { - "line": 604, - "column": 3, - "index": 15346 - } - }, - "context": { - "loc": { - "start": { - "line": 605, - "column": 0, - "index": 15347 - }, - "end": { - "line": 605, - "column": 43, - "index": 15390 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayHeight", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayHeight", - "scope": "instance" - } - ], - "namespace": "p5#displayHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 607, - "column": 0, - "index": 15392 - }, - "end": { - "line": 631, - "column": 3, - "index": 16081 - } - }, - "context": { - "loc": { - "start": { - "line": 632, - "column": 0, - "index": 16082 - }, - "end": { - "line": 632, - "column": 44, - "index": 16126 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowWidth", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowWidth", - "scope": "instance" - } - ], - "namespace": "p5#windowWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 634, - "column": 0, - "index": 16128 - }, - "end": { - "line": 658, - "column": 3, - "index": 16819 - } - }, - "context": { - "loc": { - "start": { - "line": 659, - "column": 0, - "index": 16820 - }, - "end": { - "line": 659, - "column": 46, - "index": 16866 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowHeight", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowHeight", - "scope": "instance" - } - ], - "namespace": "p5#windowHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "width" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "width" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 750, - "column": 0, - "index": 19217 - }, - "end": { - "line": 816, - "column": 3, - "index": 20713 - } - }, - "context": { - "loc": { - "start": { - "line": 817, - "column": 0, - "index": 20714 - }, - "end": { - "line": 817, - "column": 23, - "index": 20737 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "width", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "width", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "width", - "scope": "instance" - } - ], - "namespace": "p5#width" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "height" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "height" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 819, - "column": 0, - "index": 20739 - }, - "end": { - "line": 885, - "column": 3, - "index": 22246 - } - }, - "context": { - "loc": { - "start": { - "line": 886, - "column": 0, - "index": 22247 - }, - "end": { - "line": 886, - "column": 24, - "index": 22271 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "height", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "height", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "height", - "scope": "instance" - } - ], - "namespace": "p5#height" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "nothing displayed", - "lineNumber": 20 - } - ], - "loc": { - "start": { - "line": 317, - "column": 4, - "index": 10982 - }, - "end": { - "line": 340, - "column": 7, - "index": 11811 - } - }, - "context": { - "loc": { - "start": { - "line": 341, - "column": 4, - "index": 11816 - }, - "end": { - "line": 402, - "column": 6, - "index": 13726 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "remove", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "remove", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#remove" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function does 3 things:" - } - ] - }, - { - "type": "list", - "ordered": true, - "start": 1, - "spread": true, - "children": [ - { - "type": "listItem", - "spread": true, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Bounds the desired start/stop angles for an arc (in radians) so that:" - } - ] - }, - { - "type": "code", - "lang": null, - "meta": null, - "value": "0 <= start < TWO_PI ; start <= stop < start + TWO_PI" - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This means that the arc rendering functions don't have to be concerned\nwith what happens if stop is smaller than start, or if the arc 'goes\nround more than once', etc.: they can just start at start and increase\nuntil stop and the correct arc will be drawn." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Optionally adjusts the angles within each quadrant to counter the naive\nscaling of the underlying ellipse up from the unit circle. Without\nthis, the angles become arbitrary when width != height: 45 degrees\nmight be drawn at 5 degrees on a 'wide' ellipse, or at 85 degrees on\na 'tall' ellipse." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Flags up when start and stop correspond to the same place on the\nunderlying ellipse. This is useful if you want to do something special\nthere (like rendering a whole ellipse instead)." - } - ] - } - ] - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 16, - "column": 0, - "index": 333 - }, - "end": { - "line": 37, - "column": 3, - "index": 1365 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 1366 - }, - "end": { - "line": 100, - "column": 2, - "index": 3623 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "start", - "lineNumber": 39 - }, - { - "title": "param", - "name": "stop", - "lineNumber": 40 - }, - { - "title": "param", - "name": "width", - "lineNumber": 41 - }, - { - "title": "param", - "name": "height", - "lineNumber": 42 - }, - { - "title": "param", - "name": "correctForScaling", - "lineNumber": 43 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_normalizeArcAngles", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_normalizeArcAngles", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_normalizeArcAngles" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for select and selectAll" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 6392 - }, - "end": { - "line": 193, - "column": 3, - "index": 6443 - } - }, - "context": { - "loc": { - "start": { - "line": 194, - "column": 0, - "index": 6444 - }, - "end": { - "line": 204, - "column": 2, - "index": 6751 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "p", - "lineNumber": 194 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_getContainer", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_getContainer", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_getContainer" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for getElement and getElements." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 206, - "column": 0, - "index": 6753 - }, - "end": { - "line": 208, - "column": 3, - "index": 6811 - } - }, - "context": { - "loc": { - "start": { - "line": 209, - "column": 0, - "index": 6812 - }, - "end": { - "line": 238, - "column": 2, - "index": 7767 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "elt", - "lineNumber": 209 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_wrapElement", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_wrapElement", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_wrapElement" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "INPUT *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 715, - "column": 0, - "index": 21883 - }, - "end": { - "line": 715, - "column": 13, - "index": 21896 - } - }, - "context": { - "loc": { - "start": { - "line": 827, - "column": 0, - "index": 24953 - }, - "end": { - "line": 840, - "column": 2, - "index": 25384 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "min", - "lineNumber": 827 - }, - { - "title": "param", - "name": "max", - "lineNumber": 827 - }, - { - "title": "param", - "name": "value", - "lineNumber": 827 - }, - { - "title": "param", - "name": "step", - "lineNumber": 827 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createSlider", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createSlider", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createSlider" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "AUDIO STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2041, - "column": 0, - "index": 61417 - }, - "end": { - "line": 2041, - "column": 19, - "index": 61436 - } - }, - "context": { - "loc": { - "start": { - "line": 2080, - "column": 0, - "index": 62975 - }, - "end": { - "line": 2083, - "column": 2, - "index": 63135 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "src", - "lineNumber": 2080 - }, - { - "title": "param", - "name": "callback", - "lineNumber": 2080 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createAudio", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createAudio", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createAudio" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "CAMERA STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2085, - "column": 0, - "index": 63137 - }, - "end": { - "line": 2085, - "column": 20, - "index": 63157 - } - }, - "context": { - "loc": { - "start": { - "line": 2087, - "column": 0, - "index": 63159 - }, - "end": { - "line": 2087, - "column": 29, - "index": 63188 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "VIDEO", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "VIDEO", - "scope": "instance" - } - ], - "namespace": "p5#VIDEO" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - }, - "name": "deviceOrientation" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 20, - "column": 3, - "index": 511 - } - }, - "context": { - "loc": { - "start": { - "line": 21, - "column": 0, - "index": 512 - }, - "end": { - "line": 22, - "column": 74, - "index": 619 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deviceOrientation", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deviceOrientation", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deviceOrientation", - "scope": "instance" - } - ], - "namespace": "p5#deviceOrientation" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationX always contains the acceleration of the\ndevice along the x axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 24, - "column": 0, - "index": 621 - }, - "end": { - "line": 43, - "column": 3, - "index": 1167 - } - }, - "context": { - "loc": { - "start": { - "line": 44, - "column": 0, - "index": 1168 - }, - "end": { - "line": 44, - "column": 31, - "index": 1199 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationX", - "scope": "instance" - } - ], - "namespace": "p5#accelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationY always contains the acceleration of the\ndevice along the y axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 46, - "column": 0, - "index": 1201 - }, - "end": { - "line": 65, - "column": 3, - "index": 1746 - } - }, - "context": { - "loc": { - "start": { - "line": 66, - "column": 0, - "index": 1747 - }, - "end": { - "line": 66, - "column": 31, - "index": 1778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationY", - "scope": "instance" - } - ], - "namespace": "p5#accelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationZ always contains the acceleration of the\ndevice along the z axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 68, - "column": 0, - "index": 1780 - }, - "end": { - "line": 88, - "column": 3, - "index": 2328 - } - }, - "context": { - "loc": { - "start": { - "line": 89, - "column": 0, - "index": 2329 - }, - "end": { - "line": 89, - "column": 31, - "index": 2360 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationZ", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#accelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 91, - "column": 0, - "index": 2362 - }, - "end": { - "line": 98, - "column": 3, - "index": 2625 - } - }, - "context": { - "loc": { - "start": { - "line": 99, - "column": 0, - "index": 2626 - }, - "end": { - "line": 99, - "column": 32, - "index": 2658 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationX", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationX", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 101, - "column": 0, - "index": 2660 - }, - "end": { - "line": 108, - "column": 3, - "index": 2923 - } - }, - "context": { - "loc": { - "start": { - "line": 109, - "column": 0, - "index": 2924 - }, - "end": { - "line": 109, - "column": 32, - "index": 2956 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationY", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationY", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 111, - "column": 0, - "index": 2958 - }, - "end": { - "line": 118, - "column": 3, - "index": 3221 - } - }, - "context": { - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 3222 - }, - "end": { - "line": 119, - "column": 32, - "index": 3254 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationZ", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationX always contains the rotation of the\ndevice along the x axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES, the value will be -180 to 180. If\nit is set to RADIANS, the value will be -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 132, - "column": 0, - "index": 3568 - }, - "end": { - "line": 162, - "column": 3, - "index": 4447 - } - }, - "context": { - "loc": { - "start": { - "line": 163, - "column": 0, - "index": 4448 - }, - "end": { - "line": 163, - "column": 27, - "index": 4475 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationX", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationX", - "scope": "instance" - } - ], - "namespace": "p5#rotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationY always contains the rotation of the\ndevice along the y axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 165, - "column": 0, - "index": 4477 - }, - "end": { - "line": 195, - "column": 3, - "index": 5358 - } - }, - "context": { - "loc": { - "start": { - "line": 196, - "column": 0, - "index": 5359 - }, - "end": { - "line": 196, - "column": 27, - "index": 5386 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationY", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationY", - "scope": "instance" - } - ], - "namespace": "p5#rotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationZ always contains the rotation of the\ndevice along the z axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Unlike rotationX and rotationY, this variable is available for devices\nwith a built-in compass only." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - }, - { - "title": "property", - "description": null, - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 33 - } - ], - "loc": { - "start": { - "line": 198, - "column": 0, - "index": 5388 - }, - "end": { - "line": 232, - "column": 3, - "index": 6377 - } - }, - "context": { - "loc": { - "start": { - "line": 233, - "column": 0, - "index": 6378 - }, - "end": { - "line": 233, - "column": 27, - "index": 6405 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationZ", - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationZ", - "scope": "instance" - } - ], - "namespace": "p5#rotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES,\nthe value will be -180 to 180. If it is set to RADIANS, the value will\nbe -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationX can also be used with rotationX to determine the rotate\ndirection of the device along the X-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 40 - } - ], - "loc": { - "start": { - "line": 235, - "column": 0, - "index": 6407 - }, - "end": { - "line": 276, - "column": 3, - "index": 7745 - } - }, - "context": { - "loc": { - "start": { - "line": 277, - "column": 0, - "index": 7746 - }, - "end": { - "line": 277, - "column": 28, - "index": 7774 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationX", - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationX", - "scope": "instance" - } - ], - "namespace": "p5#pRotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationY can also be used with rotationY to determine the rotate\ndirection of the device along the Y-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 39 - } - ], - "loc": { - "start": { - "line": 279, - "column": 0, - "index": 7776 - }, - "end": { - "line": 319, - "column": 3, - "index": 9113 - } - }, - "context": { - "loc": { - "start": { - "line": 320, - "column": 0, - "index": 9114 - }, - "end": { - "line": 320, - "column": 28, - "index": 9142 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationY", - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationY", - "scope": "instance" - } - ], - "namespace": "p5#pRotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationZ can also be used with rotationZ to determine the rotate\ndirection of the device along the Z-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 35 - } - ], - "loc": { - "start": { - "line": 322, - "column": 0, - "index": 9144 - }, - "end": { - "line": 358, - "column": 3, - "index": 10350 - } - }, - "context": { - "loc": { - "start": { - "line": 359, - "column": 0, - "index": 10351 - }, - "end": { - "line": 359, - "column": 28, - "index": 10379 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationZ", - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationZ", - "scope": "instance" - } - ], - "namespace": "p5#pRotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When a device is rotated, the axis that triggers the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "deviceTurned()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nmethod is stored in the turnAxis variable. The turnAxis variable is only defined within\nthe scope of deviceTurned()." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "turnAxis" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 379, - "column": 0, - "index": 10890 - }, - "end": { - "line": 412, - "column": 3, - "index": 11826 - } - }, - "context": { - "loc": { - "start": { - "line": 413, - "column": 0, - "index": 11827 - }, - "end": { - "line": 413, - "column": 34, - "index": 11861 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "turnAxis", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "turnAxis", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "turnAxis", - "scope": "instance" - } - ], - "namespace": "p5#turnAxis" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyIsPressed" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is true if any key is pressed\nand false if no keys are pressed." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "keyIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 111 - }, - "end": { - "line": 30, - "column": 3, - "index": 575 - } - }, - "context": { - "loc": { - "start": { - "line": 31, - "column": 0, - "index": 576 - }, - "end": { - "line": 31, - "column": 34, - "index": 610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "isKeyPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "isKeyPressed", - "scope": "instance" - } - ], - "namespace": "p5#isKeyPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyTyped()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". For non-ASCII keys, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyCode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nvariable." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "key" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 34, - "column": 0, - "index": 655 - }, - "end": { - "line": 57, - "column": 3, - "index": 1373 - } - }, - "context": { - "loc": { - "start": { - "line": 58, - "column": 0, - "index": 1374 - }, - "end": { - "line": 58, - "column": 22, - "index": 1396 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "key", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "key", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "key", - "scope": "instance" - } - ], - "namespace": "p5#key" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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: " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keycode.info" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "keyCode" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 60, - "column": 0, - "index": 1398 - }, - "end": { - "line": 95, - "column": 3, - "index": 2425 - } - }, - "context": { - "loc": { - "start": { - "line": 96, - "column": 0, - "index": 2426 - }, - "end": { - "line": 96, - "column": 25, - "index": 2451 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyCode", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "keyCode", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "keyCode", - "scope": "instance" - } - ], - "namespace": "p5#keyCode" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The onblur function is called when the user is no longer focused\non the p5 element. Because the keyup events will not fire if the user is\nnot focused on the element we must assume all keys currently down have\nbeen released." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 291, - "column": 0, - "index": 8735 - }, - "end": { - "line": 296, - "column": 3, - "index": 8978 - } - }, - "context": { - "loc": { - "start": { - "line": 297, - "column": 0, - "index": 8979 - }, - "end": { - "line": 299, - "column": 2, - "index": 9041 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "e", - "lineNumber": 297 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_onblur", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_onblur", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_onblur" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedX contains the horizontal movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 4 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 40, - "column": 3, - "index": 777 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 778 - }, - "end": { - "line": 41, - "column": 24, - "index": 802 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedX", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedX", - "scope": "instance" - } - ], - "namespace": "p5#movedX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedY contains the vertical movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 43, - "column": 0, - "index": 804 - }, - "end": { - "line": 70, - "column": 3, - "index": 1394 - } - }, - "context": { - "loc": { - "start": { - "line": 71, - "column": 0, - "index": 1395 - }, - "end": { - "line": 71, - "column": 24, - "index": 1419 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedY", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedY", - "scope": "instance" - } - ], - "namespace": "p5#movedY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 80, - "column": 0, - "index": 1666 - }, - "end": { - "line": 101, - "column": 3, - "index": 2316 - } - }, - "context": { - "loc": { - "start": { - "line": 102, - "column": 0, - "index": 2317 - }, - "end": { - "line": 102, - "column": 24, - "index": 2341 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseX", - "scope": "instance" - } - ], - "namespace": "p5#mouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 2343 - }, - "end": { - "line": 125, - "column": 3, - "index": 2986 - } - }, - "context": { - "loc": { - "start": { - "line": 126, - "column": 0, - "index": 2987 - }, - "end": { - "line": 126, - "column": 24, - "index": 3011 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseY", - "scope": "instance" - } - ], - "namespace": "p5#mouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 128, - "column": 0, - "index": 3013 - }, - "end": { - "line": 156, - "column": 3, - "index": 3890 - } - }, - "context": { - "loc": { - "start": { - "line": 157, - "column": 0, - "index": 3891 - }, - "end": { - "line": 157, - "column": 25, - "index": 3916 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseX", - "scope": "instance" - } - ], - "namespace": "p5#pmouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 159, - "column": 0, - "index": 3918 - }, - "end": { - "line": 186, - "column": 3, - "index": 4745 - } - }, - "context": { - "loc": { - "start": { - "line": 187, - "column": 0, - "index": 4746 - }, - "end": { - "line": 187, - "column": 25, - "index": 4771 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseY", - "scope": "instance" - } - ], - "namespace": "p5#pmouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseX always contains the current horizontal\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 189, - "column": 0, - "index": 4773 - }, - "end": { - "line": 223, - "column": 3, - "index": 5653 - } - }, - "context": { - "loc": { - "start": { - "line": 224, - "column": 0, - "index": 5654 - }, - "end": { - "line": 224, - "column": 27, - "index": 5681 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseX", - "scope": "instance" - } - ], - "namespace": "p5#winMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseY always contains the current vertical\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 226, - "column": 0, - "index": 5683 - }, - "end": { - "line": 260, - "column": 3, - "index": 6560 - } - }, - "context": { - "loc": { - "start": { - "line": 261, - "column": 0, - "index": 6561 - }, - "end": { - "line": 261, - "column": 27, - "index": 6588 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseY", - "scope": "instance" - } - ], - "namespace": "p5#winMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 263, - "column": 0, - "index": 6590 - }, - "end": { - "line": 299, - "column": 3, - "index": 7675 - } - }, - "context": { - "loc": { - "start": { - "line": 300, - "column": 0, - "index": 7676 - }, - "end": { - "line": 300, - "column": 28, - "index": 7704 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseX", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseX", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 302, - "column": 0, - "index": 7706 - }, - "end": { - "line": 338, - "column": 3, - "index": 8785 - } - }, - "context": { - "loc": { - "start": { - "line": 339, - "column": 0, - "index": 8786 - }, - "end": { - "line": 339, - "column": 28, - "index": 8814 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseY", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseY", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - }, - "name": "mouseButton" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 341, - "column": 0, - "index": 8816 - }, - "end": { - "line": 375, - "column": 3, - "index": 9715 - } - }, - "context": { - "loc": { - "start": { - "line": 376, - "column": 0, - "index": 9716 - }, - "end": { - "line": 376, - "column": 29, - "index": 9745 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseButton", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseButton", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseButton", - "scope": "instance" - } - ], - "namespace": "p5#mouseButton" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable mouseIsPressed is true if the mouse is pressed\nand false if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "mouseIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 378, - "column": 0, - "index": 9747 - }, - "end": { - "line": 404, - "column": 3, - "index": 10289 - } - }, - "context": { - "loc": { - "start": { - "line": 405, - "column": 0, - "index": 10290 - }, - "end": { - "line": 405, - "column": 36, - "index": 10326 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseIsPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseIsPressed", - "scope": "instance" - } - ], - "namespace": "p5#mouseIsPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The touches[] array is not supported on Safari and IE on touch-based\ndesktops (laptops)." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - }, - "name": "touches" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 108 - }, - "end": { - "line": 37, - "column": 3, - "index": 883 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 884 - }, - "end": { - "line": 38, - "column": 26, - "index": 910 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/touch.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "touches", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "touches", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "touches", - "scope": "instance" - } - ], - "namespace": "p5#touches" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An array containing the color of each pixel on the canvas. Colors are\nstored as numbers representing red, green, blue, and alpha (RGBA) values.\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " is a one-dimensional array for performance reasons." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Each pixel occupies four elements in the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array, one for each RGBA\nvalue. For example, the pixel at coordinates (0, 0) stores its RGBA values\nat " - }, - { - "type": "inlineCode", - "value": "pixels[0]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[1]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[2]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[3]" - }, - { - "type": "text", - "value": ", respectively.\nThe next pixel at coordinates (1, 0) stores its RGBA values at " - }, - { - "type": "inlineCode", - "value": "pixels[4]" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "inlineCode", - "value": "pixels[5]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[6]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[7]" - }, - { - "type": "text", - "value": ". And so on. The " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array\nfor a 100×100 canvas has 100 × 100 × 4 = 40,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Some displays use several smaller pixels to set the color at a single\npoint. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function returns\nthe pixel density of the canvas. High density displays often have a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " of 2. On such a display, the\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array for a 100×100 canvas has 200 × 200 × 4 =\n160,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Accessing the RGBA values for a point on the canvas requires a little math\nas shown below. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadPixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function\nmust be called before accessing the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array. The\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "updatePixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function must be called\nafter any changes are made." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "pixels" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 169 - }, - "end": { - "line": 103, - "column": 3, - "index": 3031 - } - }, - "context": { - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 3032 - }, - "end": { - "line": 104, - "column": 25, - "index": 3057 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pixels", - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pixels", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pixels", - "scope": "instance" - } - ], - "namespace": "p5#pixels" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function to measure ascent and descent." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 362, - "column": 0, - "index": 9474 - }, - "end": { - "line": 364, - "column": 3, - "index": 9531 - } - }, - "context": { - "loc": { - "start": { - "line": 365, - "column": 0, - "index": 9532 - }, - "end": { - "line": 367, - "column": 2, - "index": 9627 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_updateTextMetrics", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_updateTextMetrics", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_updateTextMetrics" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ensures that p5 is using a 3d renderer. throws an error if not." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2350, - "column": 0, - "index": 73393 - }, - "end": { - "line": 2352, - "column": 3, - "index": 73467 - } - }, - "context": { - "loc": { - "start": { - "line": 2353, - "column": 0, - "index": 73468 - }, - "end": { - "line": 2358, - "column": 2, - "index": 73742 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "name", - "lineNumber": 2353 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_assert3d", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_assert3d", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_assert3d" - } - ], - "events": [], - "static": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Turn off some features of the friendly error system (FES), which can give\na significant boost to performance when needed." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ndisabling the friendly error system" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "disableFriendlyErrors" - }, - { - "title": "example", - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 754, - "column": 0, - "index": 26038 - }, - "end": { - "line": 776, - "column": 3, - "index": 26889 - } - }, - "context": { - "loc": { - "start": { - "line": 777, - "column": 0, - "index": 26890 - }, - "end": { - "line": 777, - "column": 33, - "index": 26923 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "disableFriendlyErrors", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "disableFriendlyErrors", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "disableFriendlyErrors", - "scope": "static" - } - ], - "namespace": "p5.disableFriendlyErrors" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Path to the media element's source as a string." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.MediaElement", - "lineNumber": 3 - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "src" - }, - { - "title": "return", - "description": "src", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 4842, - "column": 0, - "index": 139686 - }, - "end": { - "line": 4868, - "column": 3, - "index": 140231 - } - }, - "context": { - "loc": { - "start": { - "line": 4958, - "column": 0, - "index": 142394 - }, - "end": { - "line": 5009, - "column": 2, - "index": 143967 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "src" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "File", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "File", - "scope": "static" - } - ], - "namespace": "p5.File" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Table Options\nGeneric class for handling tabular data, typically from a\nCSV, TSV, or other sort of spreadsheet file.\nCSV files are\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ncomma separated values" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", often with the data in quotes. TSV\nfiles use tabs as separators, and usually don't bother with the\nquotes.\nFile names should end with .csv if they're comma separated.\nA rough \"spec\" for CSV can be found\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "here" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nTo load files, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method.\nTo save tables to your computer, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "save" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method\nor the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "saveTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Possible options include:" - } - ] - }, - { - "type": "html", - "value": "
    \n
  • csv - parse the table as comma-separated values\n
  • tsv - parse the table as tab-separated values\n
  • header - this table has a header (title) row\n
" - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 93 - }, - "end": { - "line": 31, - "column": 3, - "index": 1053 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 1379 - }, - "end": { - "line": 1259, - "column": 2, - "index": 33791 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "Table", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addRow()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new row of data to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "set()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object is included as a parameter, then that row is\nduplicated and added to the table." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row to be added to the table", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - "name": "row" - }, - { - "title": "return", - "description": "the row that was added", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 47, - "column": 2, - "index": 1476 - }, - "end": { - "line": 94, - "column": 3, - "index": 2995 - } - }, - "context": { - "loc": { - "start": { - "line": 95, - "column": 2, - "index": 2998 - }, - "end": { - "line": 106, - "column": 3, - "index": 3319 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row to be added to the table" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the row that was added" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes a row from the table object." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to remove", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "id" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 108, - "column": 2, - "index": 3323 - }, - "end": { - "line": 145, - "column": 3, - "index": 4202 - } - }, - "context": { - "loc": { - "start": { - "line": 146, - "column": 2, - "index": 4205 - }, - "end": { - "line": 151, - "column": 3, - "index": 4410 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "id", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to remove" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a reference to the specified " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". The reference\ncan then be used to get and set values of the selected row." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to get", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "rowID" - }, - { - "title": "return", - "description": "p5.TableRow object", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 153, - "column": 2, - "index": 4414 - }, - "end": { - "line": 191, - "column": 3, - "index": 5463 - } - }, - "context": { - "loc": { - "start": { - "line": 192, - "column": 2, - "index": 5466 - }, - "end": { - "line": 194, - "column": 3, - "index": 5507 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "r", - "lineNumber": 192 - }, - { - "title": "param", - "name": "rowID", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to get" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Gets all rows from the table. Returns an array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Array of p5.TableRows", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 196, - "column": 2, - "index": 5511 - }, - "end": { - "line": 237, - "column": 3, - "index": 6588 - } - }, - "context": { - "loc": { - "start": { - "line": 238, - "column": 2, - "index": 6591 - }, - "end": { - "line": 240, - "column": 3, - "index": 6629 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 242, - "column": 2, - "index": 6633 - }, - "end": { - "line": 282, - "column": 3, - "index": 7805 - } - }, - "context": { - "loc": { - "start": { - "line": 283, - "column": 2, - "index": 7808 - }, - "end": { - "line": 301, - "column": 3, - "index": 8272 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 10, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 303, - "column": 2, - "index": 8276 - }, - "end": { - "line": 348, - "column": 3, - "index": 9683 - } - }, - "context": { - "loc": { - "start": { - "line": 349, - "column": 2, - "index": 9686 - }, - "end": { - "line": 366, - "column": 3, - "index": 10136 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "TableRow object", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 368, - "column": 2, - "index": 10140 - }, - "end": { - "line": 407, - "column": 3, - "index": 11362 - } - }, - "context": { - "loc": { - "start": { - "line": 408, - "column": 2, - "index": 11365 - }, - "end": { - "line": 423, - "column": 3, - "index": 11778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "TableRow object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 425, - "column": 2, - "index": 11782 - }, - "end": { - "line": 472, - "column": 3, - "index": 13226 - } - }, - "context": { - "loc": { - "start": { - "line": 473, - "column": 2, - "index": 13229 - }, - "end": { - "line": 489, - "column": 3, - "index": 13668 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all values in the specified column, and returns them\nas an array. The column may be specified by either its ID or title." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String or Number of the column to return", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "Array of column values", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 491, - "column": 2, - "index": 13672 - }, - "end": { - "line": 525, - "column": 3, - "index": 14658 - } - }, - "context": { - "loc": { - "start": { - "line": 526, - "column": 2, - "index": 14661 - }, - "end": { - "line": 538, - "column": 3, - "index": 14980 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 526 - }, - { - "title": "param", - "name": "column", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String or Number of the column to return" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of column values" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes all rows from a Table. While all rows are removed,\ncolumns and column titles are maintained." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 540, - "column": 2, - "index": 14984 - }, - "end": { - "line": 571, - "column": 3, - "index": 15789 - } - }, - "context": { - "loc": { - "start": { - "line": 572, - "column": 2, - "index": 15792 - }, - "end": { - "line": 575, - "column": 3, - "index": 15852 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clearRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "clearRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#clearRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new column to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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.)" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "title of the given column", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "title" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 577, - "column": 2, - "index": 15856 - }, - "end": { - "line": 619, - "column": 3, - "index": 17079 - } - }, - "context": { - "loc": { - "start": { - "line": 620, - "column": 2, - "index": 17082 - }, - "end": { - "line": 623, - "column": 3, - "index": 17160 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "title", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "title of the given column" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of columns in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of columns in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 625, - "column": 2, - "index": 17164 - }, - "end": { - "line": 655, - "column": 3, - "index": 17854 - } - }, - "context": { - "loc": { - "start": { - "line": 656, - "column": 2, - "index": 17857 - }, - "end": { - "line": 658, - "column": 3, - "index": 17912 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of columns in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumnCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumnCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumnCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of rows in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of rows in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 660, - "column": 2, - "index": 17916 - }, - "end": { - "line": 690, - "column": 3, - "index": 18564 - } - }, - "context": { - "loc": { - "start": { - "line": 691, - "column": 2, - "index": 18567 - }, - "end": { - "line": 693, - "column": 3, - "index": 18616 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of rows in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRowCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRowCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRowCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes any of the specified characters (or \"tokens\")." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String listing characters to be removed", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "chars" - }, - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 695, - "column": 2, - "index": 18620 - }, - "end": { - "line": 730, - "column": 3, - "index": 19601 - } - }, - "context": { - "loc": { - "start": { - "line": 731, - "column": 2, - "index": 19604 - }, - "end": { - "line": 764, - "column": 3, - "index": 20779 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "chars", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String listing characters to be removed" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeTokens", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeTokens", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeTokens" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 766, - "column": 2, - "index": 20783 - }, - "end": { - "line": 798, - "column": 3, - "index": 21711 - } - }, - "context": { - "loc": { - "start": { - "line": 799, - "column": 2, - "index": 21714 - }, - "end": { - "line": 827, - "column": 3, - "index": 22666 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "trim", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "trim", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#trim" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "removeColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "columnName (string) or ID (number)", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 829, - "column": 2, - "index": 22670 - }, - "end": { - "line": 864, - "column": 3, - "index": 23691 - } - }, - "context": { - "loc": { - "start": { - "line": 865, - "column": 2, - "index": 23694 - }, - "end": { - "line": 888, - "column": 3, - "index": 24362 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "c", - "lineNumber": 865 - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or ID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 890, - "column": 2, - "index": 24366 - }, - "end": { - "line": 932, - "column": 3, - "index": 25518 - } - }, - "context": { - "loc": { - "start": { - "line": 933, - "column": 2, - "index": 25521 - }, - "end": { - "line": 935, - "column": 3, - "index": 25590 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "set", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "set", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#set" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 937, - "column": 2, - "index": 25594 - }, - "end": { - "line": 976, - "column": 3, - "index": 26578 - } - }, - "context": { - "loc": { - "start": { - "line": 977, - "column": 2, - "index": 26581 - }, - "end": { - "line": 979, - "column": 3, - "index": 26656 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 981, - "column": 2, - "index": 26660 - }, - "end": { - "line": 1019, - "column": 3, - "index": 27767 - } - }, - "context": { - "loc": { - "start": { - "line": 1020, - "column": 2, - "index": 27770 - }, - "end": { - "line": 1022, - "column": 3, - "index": 27851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1024, - "column": 2, - "index": 27855 - }, - "end": { - "line": 1062, - "column": 3, - "index": 28842 - } - }, - "context": { - "loc": { - "start": { - "line": 1063, - "column": 2, - "index": 28845 - }, - "end": { - "line": 1065, - "column": 3, - "index": 28907 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "get", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "get", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#get" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1067, - "column": 2, - "index": 28911 - }, - "end": { - "line": 1103, - "column": 3, - "index": 29853 - } - }, - "context": { - "loc": { - "start": { - "line": 1104, - "column": 2, - "index": 29856 - }, - "end": { - "line": 1106, - "column": 3, - "index": 29924 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1108, - "column": 2, - "index": 29928 - }, - "end": { - "line": 1151, - "column": 3, - "index": 31214 - } - }, - "context": { - "loc": { - "start": { - "line": 1153, - "column": 2, - "index": 31218 - }, - "end": { - "line": 1155, - "column": 3, - "index": 31292 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Name of the column which should be used to\n title each row object (optional)", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "headerColumn" - }, - { - "title": "return", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 1157, - "column": 2, - "index": 31296 - }, - "end": { - "line": 1195, - "column": 3, - "index": 32265 - } - }, - "context": { - "loc": { - "start": { - "line": 1196, - "column": 2, - "index": 32268 - }, - "end": { - "line": 1216, - "column": 3, - "index": 32851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "headerColumn", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Name of the column which should be used to\ntitle each row object (optional)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getObject", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getObject", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getObject" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all table data and returns it as a multidimensional array." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 1218, - "column": 2, - "index": 32855 - }, - "end": { - "line": 1251, - "column": 3, - "index": 33622 - } - }, - "context": { - "loc": { - "start": { - "line": 1252, - "column": 2, - "index": 33625 - }, - "end": { - "line": 1258, - "column": 3, - "index": 33788 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getArray", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getArray" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - } - ], - "namespace": "p5.Table" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An internal class to store data that will be sent to a p5.RenderBuffer.\nThose need to eventually go into a Float32Array, so this class provides a\nvariable-length array container backed by a Float32Array so that it can be\nsent to the GPU without allocating a new array each frame." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Like a C++ vector, its fixed-length Float32Array backing its contents will\ndouble in size when it goes over its capacity." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 3, - "column": 0, - "index": 32 - }, - "end": { - "line": 27, - "column": 3, - "index": 926 - } - }, - "context": { - "loc": { - "start": { - "line": 28, - "column": 0, - "index": 927 - }, - "end": { - "line": 108, - "column": 2, - "index": 2998 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "DataArray", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a Float32Array window sized to the exact length of the data" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 35, - "column": 2, - "index": 1114 - }, - "end": { - "line": 37, - "column": 5, - "index": 1196 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 2, - "index": 1199 - }, - "end": { - "line": 40, - "column": 3, - "index": 1258 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dataArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "dataArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#dataArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A \"soft\" clear, which keeps the underlying storage size the same, but\nempties the contents of its dataArray()" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 42, - "column": 2, - "index": 1262 - }, - "end": { - "line": 45, - "column": 5, - "index": 1391 - } - }, - "context": { - "loc": { - "start": { - "line": 46, - "column": 2, - "index": 1394 - }, - "end": { - "line": 48, - "column": 3, - "index": 1428 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clear", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "clear", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#clear" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Can be used to scale a DataArray back down to fit its contents." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 50, - "column": 2, - "index": 1432 - }, - "end": { - "line": 52, - "column": 5, - "index": 1510 - } - }, - "context": { - "loc": { - "start": { - "line": 53, - "column": 2, - "index": 1513 - }, - "end": { - "line": 61, - "column": 3, - "index": 1839 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rescale", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "rescale", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#rescale" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A full reset, which allocates a new underlying Float32Array at its initial\nlength" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 63, - "column": 2, - "index": 1843 - }, - "end": { - "line": 66, - "column": 5, - "index": 1944 - } - }, - "context": { - "loc": { - "start": { - "line": 67, - "column": 2, - "index": 1947 - }, - "end": { - "line": 70, - "column": 3, - "index": 2032 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "reset", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "reset", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#reset" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Adds values to the DataArray, expanding its internal storage to\naccommodate the new items." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 72, - "column": 2, - "index": 2036 - }, - "end": { - "line": 75, - "column": 5, - "index": 2146 - } - }, - "context": { - "loc": { - "start": { - "line": 76, - "column": 2, - "index": 2149 - }, - "end": { - "line": 80, - "column": 3, - "index": 2296 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "values", - "lineNumber": 76, - "type": { - "type": "RestType" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "push", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "push", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#push" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a copy of the data from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to the index\n" - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 82, - "column": 2, - "index": 2300 - }, - "end": { - "line": 85, - "column": 5, - "index": 2409 - } - }, - "context": { - "loc": { - "start": { - "line": 86, - "column": 2, - "index": 2412 - }, - "end": { - "line": 88, - "column": 3, - "index": 2494 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 86 - }, - { - "title": "param", - "name": "to", - "lineNumber": 86 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "slice", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "slice", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#slice" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a mutable Float32Array window from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to\nthe index " - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 90, - "column": 2, - "index": 2498 - }, - "end": { - "line": 93, - "column": 5, - "index": 2618 - } - }, - "context": { - "loc": { - "start": { - "line": 94, - "column": 2, - "index": 2621 - }, - "end": { - "line": 96, - "column": 3, - "index": 2709 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 94 - }, - { - "title": "param", - "name": "to", - "lineNumber": 94 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "subArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "subArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#subArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Expand capacity of the internal storage until it can fit a target size" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 98, - "column": 2, - "index": 2713 - }, - "end": { - "line": 100, - "column": 5, - "index": 2798 - } - }, - "context": { - "loc": { - "start": { - "line": 101, - "column": 2, - "index": 2801 - }, - "end": { - "line": 107, - "column": 3, - "index": 2995 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "target", - "lineNumber": 101 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "ensureLength", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "ensureLength", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#ensureLength" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - } - ], - "namespace": "p5.DataArray" - } - ] - }, - "path": [ - { - "name": "p5" - } - ], - "namespace": "p5" - }, - { - "description": "", - "tags": [ - { - "title": "for", - "description": "p5", - "lineNumber": 1 - }, - { - "title": "requires", - "description": null, - "lineNumber": 2, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 4, - "column": 3, - "index": 36 - } - }, - "context": { - "loc": { - "start": { - "line": 5, - "column": 0, - "index": 37 - }, - "end": { - "line": 5, - "column": 25, - "index": 62 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/friendly_errors/validate_params.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "p5", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the number of frames drawn since the sketch started." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "frameCount" - }, - { - "type": "text", - "value": "'s value is 0 inside " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". It\nincrements by 1 each time the code in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfinishes executing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "frameCount" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 69, - "column": 0, - "index": 1553 - }, - "end": { - "line": 116, - "column": 3, - "index": 2581 - } - }, - "context": { - "loc": { - "start": { - "line": 117, - "column": 0, - "index": 2582 - }, - "end": { - "line": 117, - "column": 28, - "index": 2610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "frameCount", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "frameCount", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "frameCount", - "scope": "instance" - } - ], - "namespace": "p5#frameCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the amount of time, in milliseconds, it took for\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to draw the previous frame. " - }, - { - "type": "inlineCode", - "value": "deltaTime" - }, - { - "type": "text", - "value": " is\nuseful for simulating physics." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "deltaTime" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 2612 - }, - "end": { - "line": 161, - "column": 3, - "index": 3539 - } - }, - "context": { - "loc": { - "start": { - "line": 162, - "column": 0, - "index": 3540 - }, - "end": { - "line": 162, - "column": 27, - "index": 3567 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deltaTime", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deltaTime", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deltaTime", - "scope": "instance" - } - ], - "namespace": "p5#deltaTime" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks whether the browser window is focused and can receive user input.\n" - }, - { - "type": "inlineCode", - "value": "focused" - }, - { - "type": "text", - "value": " is " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": " if the window if focused and " - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "focused" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 164, - "column": 0, - "index": 3569 - }, - "end": { - "line": 190, - "column": 3, - "index": 4257 - } - }, - "context": { - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 4258 - }, - "end": { - "line": 191, - "column": 43, - "index": 4301 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "focused", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "focused", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "focused", - "scope": "instance" - } - ], - "namespace": "p5#focused" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A string variable with the WebGL version in use. Its value equals one of\nthe followin string constants:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL2" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl2'" - }, - { - "type": "text", - "value": "," - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl'" - }, - { - "type": "text", - "value": ", or" - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "P2D" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'p2d'" - }, - { - "type": "text", - "value": ". This is the default for 2D sketches." - } - ] - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setAttributes()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for ways to set the\nWebGL version." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - }, - "name": "webglVersion" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 12 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 466, - "column": 0, - "index": 12055 - }, - "end": { - "line": 544, - "column": 3, - "index": 13784 - } - }, - "context": { - "loc": { - "start": { - "line": 545, - "column": 0, - "index": 13785 - }, - "end": { - "line": 545, - "column": 34, - "index": 13819 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "webglVersion", - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "webglVersion", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "webglVersion", - "scope": "instance" - } - ], - "namespace": "p5#webglVersion" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayWidth" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen width can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayWidth * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 547, - "column": 0, - "index": 13821 - }, - "end": { - "line": 574, - "column": 3, - "index": 14559 - } - }, - "context": { - "loc": { - "start": { - "line": 575, - "column": 0, - "index": 14560 - }, - "end": { - "line": 575, - "column": 41, - "index": 14601 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayWidth", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayWidth", - "scope": "instance" - } - ], - "namespace": "p5#displayWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayHeight" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen height can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayHeight * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 577, - "column": 0, - "index": 14603 - }, - "end": { - "line": 604, - "column": 3, - "index": 15346 - } - }, - "context": { - "loc": { - "start": { - "line": 605, - "column": 0, - "index": 15347 - }, - "end": { - "line": 605, - "column": 43, - "index": 15390 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayHeight", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayHeight", - "scope": "instance" - } - ], - "namespace": "p5#displayHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 607, - "column": 0, - "index": 15392 - }, - "end": { - "line": 631, - "column": 3, - "index": 16081 - } - }, - "context": { - "loc": { - "start": { - "line": 632, - "column": 0, - "index": 16082 - }, - "end": { - "line": 632, - "column": 44, - "index": 16126 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowWidth", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowWidth", - "scope": "instance" - } - ], - "namespace": "p5#windowWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 634, - "column": 0, - "index": 16128 - }, - "end": { - "line": 658, - "column": 3, - "index": 16819 - } - }, - "context": { - "loc": { - "start": { - "line": 659, - "column": 0, - "index": 16820 - }, - "end": { - "line": 659, - "column": 46, - "index": 16866 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowHeight", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowHeight", - "scope": "instance" - } - ], - "namespace": "p5#windowHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "width" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "width" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 750, - "column": 0, - "index": 19217 - }, - "end": { - "line": 816, - "column": 3, - "index": 20713 - } - }, - "context": { - "loc": { - "start": { - "line": 817, - "column": 0, - "index": 20714 - }, - "end": { - "line": 817, - "column": 23, - "index": 20737 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "width", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "width", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "width", - "scope": "instance" - } - ], - "namespace": "p5#width" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "height" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "height" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 819, - "column": 0, - "index": 20739 - }, - "end": { - "line": 885, - "column": 3, - "index": 22246 - } - }, - "context": { - "loc": { - "start": { - "line": 886, - "column": 0, - "index": 22247 - }, - "end": { - "line": 886, - "column": 24, - "index": 22271 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "height", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "height", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "height", - "scope": "instance" - } - ], - "namespace": "p5#height" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "nothing displayed", - "lineNumber": 20 - } - ], - "loc": { - "start": { - "line": 317, - "column": 4, - "index": 10982 - }, - "end": { - "line": 340, - "column": 7, - "index": 11811 - } - }, - "context": { - "loc": { - "start": { - "line": 341, - "column": 4, - "index": 11816 - }, - "end": { - "line": 402, - "column": 6, - "index": 13726 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "remove", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "remove", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#remove" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function does 3 things:" - } - ] - }, - { - "type": "list", - "ordered": true, - "start": 1, - "spread": true, - "children": [ - { - "type": "listItem", - "spread": true, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Bounds the desired start/stop angles for an arc (in radians) so that:" - } - ] - }, - { - "type": "code", - "lang": null, - "meta": null, - "value": "0 <= start < TWO_PI ; start <= stop < start + TWO_PI" - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This means that the arc rendering functions don't have to be concerned\nwith what happens if stop is smaller than start, or if the arc 'goes\nround more than once', etc.: they can just start at start and increase\nuntil stop and the correct arc will be drawn." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Optionally adjusts the angles within each quadrant to counter the naive\nscaling of the underlying ellipse up from the unit circle. Without\nthis, the angles become arbitrary when width != height: 45 degrees\nmight be drawn at 5 degrees on a 'wide' ellipse, or at 85 degrees on\na 'tall' ellipse." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Flags up when start and stop correspond to the same place on the\nunderlying ellipse. This is useful if you want to do something special\nthere (like rendering a whole ellipse instead)." - } - ] - } - ] - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 16, - "column": 0, - "index": 333 - }, - "end": { - "line": 37, - "column": 3, - "index": 1365 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 1366 - }, - "end": { - "line": 100, - "column": 2, - "index": 3623 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "start", - "lineNumber": 39 - }, - { - "title": "param", - "name": "stop", - "lineNumber": 40 - }, - { - "title": "param", - "name": "width", - "lineNumber": 41 - }, - { - "title": "param", - "name": "height", - "lineNumber": 42 - }, - { - "title": "param", - "name": "correctForScaling", - "lineNumber": 43 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_normalizeArcAngles", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_normalizeArcAngles", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_normalizeArcAngles" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for select and selectAll" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 6392 - }, - "end": { - "line": 193, - "column": 3, - "index": 6443 - } - }, - "context": { - "loc": { - "start": { - "line": 194, - "column": 0, - "index": 6444 - }, - "end": { - "line": 204, - "column": 2, - "index": 6751 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "p", - "lineNumber": 194 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_getContainer", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_getContainer", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_getContainer" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for getElement and getElements." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 206, - "column": 0, - "index": 6753 - }, - "end": { - "line": 208, - "column": 3, - "index": 6811 - } - }, - "context": { - "loc": { - "start": { - "line": 209, - "column": 0, - "index": 6812 - }, - "end": { - "line": 238, - "column": 2, - "index": 7767 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "elt", - "lineNumber": 209 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_wrapElement", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_wrapElement", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_wrapElement" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "INPUT *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 715, - "column": 0, - "index": 21883 - }, - "end": { - "line": 715, - "column": 13, - "index": 21896 - } - }, - "context": { - "loc": { - "start": { - "line": 827, - "column": 0, - "index": 24953 - }, - "end": { - "line": 840, - "column": 2, - "index": 25384 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "min", - "lineNumber": 827 - }, - { - "title": "param", - "name": "max", - "lineNumber": 827 - }, - { - "title": "param", - "name": "value", - "lineNumber": 827 - }, - { - "title": "param", - "name": "step", - "lineNumber": 827 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createSlider", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createSlider", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createSlider" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "AUDIO STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2041, - "column": 0, - "index": 61417 - }, - "end": { - "line": 2041, - "column": 19, - "index": 61436 - } - }, - "context": { - "loc": { - "start": { - "line": 2080, - "column": 0, - "index": 62975 - }, - "end": { - "line": 2083, - "column": 2, - "index": 63135 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "src", - "lineNumber": 2080 - }, - { - "title": "param", - "name": "callback", - "lineNumber": 2080 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createAudio", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createAudio", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createAudio" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "CAMERA STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2085, - "column": 0, - "index": 63137 - }, - "end": { - "line": 2085, - "column": 20, - "index": 63157 - } - }, - "context": { - "loc": { - "start": { - "line": 2087, - "column": 0, - "index": 63159 - }, - "end": { - "line": 2087, - "column": 29, - "index": 63188 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "VIDEO", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "VIDEO", - "scope": "instance" - } - ], - "namespace": "p5#VIDEO" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - }, - "name": "deviceOrientation" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 20, - "column": 3, - "index": 511 - } - }, - "context": { - "loc": { - "start": { - "line": 21, - "column": 0, - "index": 512 - }, - "end": { - "line": 22, - "column": 74, - "index": 619 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deviceOrientation", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deviceOrientation", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deviceOrientation", - "scope": "instance" - } - ], - "namespace": "p5#deviceOrientation" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationX always contains the acceleration of the\ndevice along the x axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 24, - "column": 0, - "index": 621 - }, - "end": { - "line": 43, - "column": 3, - "index": 1167 - } - }, - "context": { - "loc": { - "start": { - "line": 44, - "column": 0, - "index": 1168 - }, - "end": { - "line": 44, - "column": 31, - "index": 1199 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationX", - "scope": "instance" - } - ], - "namespace": "p5#accelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationY always contains the acceleration of the\ndevice along the y axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 46, - "column": 0, - "index": 1201 - }, - "end": { - "line": 65, - "column": 3, - "index": 1746 - } - }, - "context": { - "loc": { - "start": { - "line": 66, - "column": 0, - "index": 1747 - }, - "end": { - "line": 66, - "column": 31, - "index": 1778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationY", - "scope": "instance" - } - ], - "namespace": "p5#accelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationZ always contains the acceleration of the\ndevice along the z axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 68, - "column": 0, - "index": 1780 - }, - "end": { - "line": 88, - "column": 3, - "index": 2328 - } - }, - "context": { - "loc": { - "start": { - "line": 89, - "column": 0, - "index": 2329 - }, - "end": { - "line": 89, - "column": 31, - "index": 2360 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationZ", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#accelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 91, - "column": 0, - "index": 2362 - }, - "end": { - "line": 98, - "column": 3, - "index": 2625 - } - }, - "context": { - "loc": { - "start": { - "line": 99, - "column": 0, - "index": 2626 - }, - "end": { - "line": 99, - "column": 32, - "index": 2658 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationX", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationX", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 101, - "column": 0, - "index": 2660 - }, - "end": { - "line": 108, - "column": 3, - "index": 2923 - } - }, - "context": { - "loc": { - "start": { - "line": 109, - "column": 0, - "index": 2924 - }, - "end": { - "line": 109, - "column": 32, - "index": 2956 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationY", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationY", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 111, - "column": 0, - "index": 2958 - }, - "end": { - "line": 118, - "column": 3, - "index": 3221 - } - }, - "context": { - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 3222 - }, - "end": { - "line": 119, - "column": 32, - "index": 3254 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationZ", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationX always contains the rotation of the\ndevice along the x axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES, the value will be -180 to 180. If\nit is set to RADIANS, the value will be -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 132, - "column": 0, - "index": 3568 - }, - "end": { - "line": 162, - "column": 3, - "index": 4447 - } - }, - "context": { - "loc": { - "start": { - "line": 163, - "column": 0, - "index": 4448 - }, - "end": { - "line": 163, - "column": 27, - "index": 4475 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationX", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationX", - "scope": "instance" - } - ], - "namespace": "p5#rotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationY always contains the rotation of the\ndevice along the y axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 165, - "column": 0, - "index": 4477 - }, - "end": { - "line": 195, - "column": 3, - "index": 5358 - } - }, - "context": { - "loc": { - "start": { - "line": 196, - "column": 0, - "index": 5359 - }, - "end": { - "line": 196, - "column": 27, - "index": 5386 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationY", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationY", - "scope": "instance" - } - ], - "namespace": "p5#rotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationZ always contains the rotation of the\ndevice along the z axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Unlike rotationX and rotationY, this variable is available for devices\nwith a built-in compass only." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - }, - { - "title": "property", - "description": null, - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 33 - } - ], - "loc": { - "start": { - "line": 198, - "column": 0, - "index": 5388 - }, - "end": { - "line": 232, - "column": 3, - "index": 6377 - } - }, - "context": { - "loc": { - "start": { - "line": 233, - "column": 0, - "index": 6378 - }, - "end": { - "line": 233, - "column": 27, - "index": 6405 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationZ", - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationZ", - "scope": "instance" - } - ], - "namespace": "p5#rotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES,\nthe value will be -180 to 180. If it is set to RADIANS, the value will\nbe -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationX can also be used with rotationX to determine the rotate\ndirection of the device along the X-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 40 - } - ], - "loc": { - "start": { - "line": 235, - "column": 0, - "index": 6407 - }, - "end": { - "line": 276, - "column": 3, - "index": 7745 - } - }, - "context": { - "loc": { - "start": { - "line": 277, - "column": 0, - "index": 7746 - }, - "end": { - "line": 277, - "column": 28, - "index": 7774 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationX", - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationX", - "scope": "instance" - } - ], - "namespace": "p5#pRotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationY can also be used with rotationY to determine the rotate\ndirection of the device along the Y-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 39 - } - ], - "loc": { - "start": { - "line": 279, - "column": 0, - "index": 7776 - }, - "end": { - "line": 319, - "column": 3, - "index": 9113 - } - }, - "context": { - "loc": { - "start": { - "line": 320, - "column": 0, - "index": 9114 - }, - "end": { - "line": 320, - "column": 28, - "index": 9142 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationY", - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationY", - "scope": "instance" - } - ], - "namespace": "p5#pRotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationZ can also be used with rotationZ to determine the rotate\ndirection of the device along the Z-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 35 - } - ], - "loc": { - "start": { - "line": 322, - "column": 0, - "index": 9144 - }, - "end": { - "line": 358, - "column": 3, - "index": 10350 - } - }, - "context": { - "loc": { - "start": { - "line": 359, - "column": 0, - "index": 10351 - }, - "end": { - "line": 359, - "column": 28, - "index": 10379 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationZ", - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationZ", - "scope": "instance" - } - ], - "namespace": "p5#pRotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When a device is rotated, the axis that triggers the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "deviceTurned()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nmethod is stored in the turnAxis variable. The turnAxis variable is only defined within\nthe scope of deviceTurned()." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "turnAxis" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 379, - "column": 0, - "index": 10890 - }, - "end": { - "line": 412, - "column": 3, - "index": 11826 - } - }, - "context": { - "loc": { - "start": { - "line": 413, - "column": 0, - "index": 11827 - }, - "end": { - "line": 413, - "column": 34, - "index": 11861 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "turnAxis", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "turnAxis", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "turnAxis", - "scope": "instance" - } - ], - "namespace": "p5#turnAxis" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyIsPressed" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is true if any key is pressed\nand false if no keys are pressed." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "keyIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 111 - }, - "end": { - "line": 30, - "column": 3, - "index": 575 - } - }, - "context": { - "loc": { - "start": { - "line": 31, - "column": 0, - "index": 576 - }, - "end": { - "line": 31, - "column": 34, - "index": 610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "isKeyPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "isKeyPressed", - "scope": "instance" - } - ], - "namespace": "p5#isKeyPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyTyped()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". For non-ASCII keys, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyCode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nvariable." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "key" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 34, - "column": 0, - "index": 655 - }, - "end": { - "line": 57, - "column": 3, - "index": 1373 - } - }, - "context": { - "loc": { - "start": { - "line": 58, - "column": 0, - "index": 1374 - }, - "end": { - "line": 58, - "column": 22, - "index": 1396 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "key", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "key", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "key", - "scope": "instance" - } - ], - "namespace": "p5#key" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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: " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keycode.info" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "keyCode" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 60, - "column": 0, - "index": 1398 - }, - "end": { - "line": 95, - "column": 3, - "index": 2425 - } - }, - "context": { - "loc": { - "start": { - "line": 96, - "column": 0, - "index": 2426 - }, - "end": { - "line": 96, - "column": 25, - "index": 2451 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyCode", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "keyCode", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "keyCode", - "scope": "instance" - } - ], - "namespace": "p5#keyCode" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The onblur function is called when the user is no longer focused\non the p5 element. Because the keyup events will not fire if the user is\nnot focused on the element we must assume all keys currently down have\nbeen released." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 291, - "column": 0, - "index": 8735 - }, - "end": { - "line": 296, - "column": 3, - "index": 8978 - } - }, - "context": { - "loc": { - "start": { - "line": 297, - "column": 0, - "index": 8979 - }, - "end": { - "line": 299, - "column": 2, - "index": 9041 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "e", - "lineNumber": 297 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_onblur", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_onblur", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_onblur" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedX contains the horizontal movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 4 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 40, - "column": 3, - "index": 777 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 778 - }, - "end": { - "line": 41, - "column": 24, - "index": 802 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedX", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedX", - "scope": "instance" - } - ], - "namespace": "p5#movedX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedY contains the vertical movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 43, - "column": 0, - "index": 804 - }, - "end": { - "line": 70, - "column": 3, - "index": 1394 - } - }, - "context": { - "loc": { - "start": { - "line": 71, - "column": 0, - "index": 1395 - }, - "end": { - "line": 71, - "column": 24, - "index": 1419 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedY", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedY", - "scope": "instance" - } - ], - "namespace": "p5#movedY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 80, - "column": 0, - "index": 1666 - }, - "end": { - "line": 101, - "column": 3, - "index": 2316 - } - }, - "context": { - "loc": { - "start": { - "line": 102, - "column": 0, - "index": 2317 - }, - "end": { - "line": 102, - "column": 24, - "index": 2341 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseX", - "scope": "instance" - } - ], - "namespace": "p5#mouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 2343 - }, - "end": { - "line": 125, - "column": 3, - "index": 2986 - } - }, - "context": { - "loc": { - "start": { - "line": 126, - "column": 0, - "index": 2987 - }, - "end": { - "line": 126, - "column": 24, - "index": 3011 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseY", - "scope": "instance" - } - ], - "namespace": "p5#mouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 128, - "column": 0, - "index": 3013 - }, - "end": { - "line": 156, - "column": 3, - "index": 3890 - } - }, - "context": { - "loc": { - "start": { - "line": 157, - "column": 0, - "index": 3891 - }, - "end": { - "line": 157, - "column": 25, - "index": 3916 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseX", - "scope": "instance" - } - ], - "namespace": "p5#pmouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 159, - "column": 0, - "index": 3918 - }, - "end": { - "line": 186, - "column": 3, - "index": 4745 - } - }, - "context": { - "loc": { - "start": { - "line": 187, - "column": 0, - "index": 4746 - }, - "end": { - "line": 187, - "column": 25, - "index": 4771 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseY", - "scope": "instance" - } - ], - "namespace": "p5#pmouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseX always contains the current horizontal\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 189, - "column": 0, - "index": 4773 - }, - "end": { - "line": 223, - "column": 3, - "index": 5653 - } - }, - "context": { - "loc": { - "start": { - "line": 224, - "column": 0, - "index": 5654 - }, - "end": { - "line": 224, - "column": 27, - "index": 5681 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseX", - "scope": "instance" - } - ], - "namespace": "p5#winMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseY always contains the current vertical\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 226, - "column": 0, - "index": 5683 - }, - "end": { - "line": 260, - "column": 3, - "index": 6560 - } - }, - "context": { - "loc": { - "start": { - "line": 261, - "column": 0, - "index": 6561 - }, - "end": { - "line": 261, - "column": 27, - "index": 6588 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseY", - "scope": "instance" - } - ], - "namespace": "p5#winMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 263, - "column": 0, - "index": 6590 - }, - "end": { - "line": 299, - "column": 3, - "index": 7675 - } - }, - "context": { - "loc": { - "start": { - "line": 300, - "column": 0, - "index": 7676 - }, - "end": { - "line": 300, - "column": 28, - "index": 7704 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseX", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseX", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 302, - "column": 0, - "index": 7706 - }, - "end": { - "line": 338, - "column": 3, - "index": 8785 - } - }, - "context": { - "loc": { - "start": { - "line": 339, - "column": 0, - "index": 8786 - }, - "end": { - "line": 339, - "column": 28, - "index": 8814 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseY", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseY", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - }, - "name": "mouseButton" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 341, - "column": 0, - "index": 8816 - }, - "end": { - "line": 375, - "column": 3, - "index": 9715 - } - }, - "context": { - "loc": { - "start": { - "line": 376, - "column": 0, - "index": 9716 - }, - "end": { - "line": 376, - "column": 29, - "index": 9745 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseButton", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseButton", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseButton", - "scope": "instance" - } - ], - "namespace": "p5#mouseButton" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable mouseIsPressed is true if the mouse is pressed\nand false if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "mouseIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 378, - "column": 0, - "index": 9747 - }, - "end": { - "line": 404, - "column": 3, - "index": 10289 - } - }, - "context": { - "loc": { - "start": { - "line": 405, - "column": 0, - "index": 10290 - }, - "end": { - "line": 405, - "column": 36, - "index": 10326 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseIsPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseIsPressed", - "scope": "instance" - } - ], - "namespace": "p5#mouseIsPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The touches[] array is not supported on Safari and IE on touch-based\ndesktops (laptops)." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - }, - "name": "touches" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 108 - }, - "end": { - "line": 37, - "column": 3, - "index": 883 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 884 - }, - "end": { - "line": 38, - "column": 26, - "index": 910 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/touch.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "touches", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "touches", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "touches", - "scope": "instance" - } - ], - "namespace": "p5#touches" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An array containing the color of each pixel on the canvas. Colors are\nstored as numbers representing red, green, blue, and alpha (RGBA) values.\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " is a one-dimensional array for performance reasons." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Each pixel occupies four elements in the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array, one for each RGBA\nvalue. For example, the pixel at coordinates (0, 0) stores its RGBA values\nat " - }, - { - "type": "inlineCode", - "value": "pixels[0]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[1]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[2]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[3]" - }, - { - "type": "text", - "value": ", respectively.\nThe next pixel at coordinates (1, 0) stores its RGBA values at " - }, - { - "type": "inlineCode", - "value": "pixels[4]" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "inlineCode", - "value": "pixels[5]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[6]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[7]" - }, - { - "type": "text", - "value": ". And so on. The " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array\nfor a 100×100 canvas has 100 × 100 × 4 = 40,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Some displays use several smaller pixels to set the color at a single\npoint. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function returns\nthe pixel density of the canvas. High density displays often have a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " of 2. On such a display, the\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array for a 100×100 canvas has 200 × 200 × 4 =\n160,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Accessing the RGBA values for a point on the canvas requires a little math\nas shown below. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadPixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function\nmust be called before accessing the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array. The\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "updatePixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function must be called\nafter any changes are made." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "pixels" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 169 - }, - "end": { - "line": 103, - "column": 3, - "index": 3031 - } - }, - "context": { - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 3032 - }, - "end": { - "line": 104, - "column": 25, - "index": 3057 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pixels", - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pixels", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pixels", - "scope": "instance" - } - ], - "namespace": "p5#pixels" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function to measure ascent and descent." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 362, - "column": 0, - "index": 9474 - }, - "end": { - "line": 364, - "column": 3, - "index": 9531 - } - }, - "context": { - "loc": { - "start": { - "line": 365, - "column": 0, - "index": 9532 - }, - "end": { - "line": 367, - "column": 2, - "index": 9627 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_updateTextMetrics", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_updateTextMetrics", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_updateTextMetrics" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ensures that p5 is using a 3d renderer. throws an error if not." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2350, - "column": 0, - "index": 73393 - }, - "end": { - "line": 2352, - "column": 3, - "index": 73467 - } - }, - "context": { - "loc": { - "start": { - "line": 2353, - "column": 0, - "index": 73468 - }, - "end": { - "line": 2358, - "column": 2, - "index": 73742 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "name", - "lineNumber": 2353 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_assert3d", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_assert3d", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_assert3d" - } - ], - "events": [], - "static": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Turn off some features of the friendly error system (FES), which can give\na significant boost to performance when needed." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ndisabling the friendly error system" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "disableFriendlyErrors" - }, - { - "title": "example", - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 754, - "column": 0, - "index": 26038 - }, - "end": { - "line": 776, - "column": 3, - "index": 26889 - } - }, - "context": { - "loc": { - "start": { - "line": 777, - "column": 0, - "index": 26890 - }, - "end": { - "line": 777, - "column": 33, - "index": 26923 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "disableFriendlyErrors", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "disableFriendlyErrors", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "disableFriendlyErrors", - "scope": "static" - } - ], - "namespace": "p5.disableFriendlyErrors" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Path to the media element's source as a string." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.MediaElement", - "lineNumber": 3 - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "src" - }, - { - "title": "return", - "description": "src", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 4842, - "column": 0, - "index": 139686 - }, - "end": { - "line": 4868, - "column": 3, - "index": 140231 - } - }, - "context": { - "loc": { - "start": { - "line": 4958, - "column": 0, - "index": 142394 - }, - "end": { - "line": 5009, - "column": 2, - "index": 143967 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "src" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "File", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "File", - "scope": "static" - } - ], - "namespace": "p5.File" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Table Options\nGeneric class for handling tabular data, typically from a\nCSV, TSV, or other sort of spreadsheet file.\nCSV files are\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ncomma separated values" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", often with the data in quotes. TSV\nfiles use tabs as separators, and usually don't bother with the\nquotes.\nFile names should end with .csv if they're comma separated.\nA rough \"spec\" for CSV can be found\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "here" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nTo load files, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method.\nTo save tables to your computer, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "save" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method\nor the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "saveTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Possible options include:" - } - ] - }, - { - "type": "html", - "value": "
    \n
  • csv - parse the table as comma-separated values\n
  • tsv - parse the table as tab-separated values\n
  • header - this table has a header (title) row\n
" - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 93 - }, - "end": { - "line": 31, - "column": 3, - "index": 1053 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 1379 - }, - "end": { - "line": 1259, - "column": 2, - "index": 33791 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "Table", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addRow()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new row of data to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "set()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object is included as a parameter, then that row is\nduplicated and added to the table." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row to be added to the table", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - "name": "row" - }, - { - "title": "return", - "description": "the row that was added", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 47, - "column": 2, - "index": 1476 - }, - "end": { - "line": 94, - "column": 3, - "index": 2995 - } - }, - "context": { - "loc": { - "start": { - "line": 95, - "column": 2, - "index": 2998 - }, - "end": { - "line": 106, - "column": 3, - "index": 3319 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row to be added to the table" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the row that was added" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes a row from the table object." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to remove", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "id" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 108, - "column": 2, - "index": 3323 - }, - "end": { - "line": 145, - "column": 3, - "index": 4202 - } - }, - "context": { - "loc": { - "start": { - "line": 146, - "column": 2, - "index": 4205 - }, - "end": { - "line": 151, - "column": 3, - "index": 4410 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "id", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to remove" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a reference to the specified " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". The reference\ncan then be used to get and set values of the selected row." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to get", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "rowID" - }, - { - "title": "return", - "description": "p5.TableRow object", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 153, - "column": 2, - "index": 4414 - }, - "end": { - "line": 191, - "column": 3, - "index": 5463 - } - }, - "context": { - "loc": { - "start": { - "line": 192, - "column": 2, - "index": 5466 - }, - "end": { - "line": 194, - "column": 3, - "index": 5507 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "r", - "lineNumber": 192 - }, - { - "title": "param", - "name": "rowID", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to get" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Gets all rows from the table. Returns an array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Array of p5.TableRows", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 196, - "column": 2, - "index": 5511 - }, - "end": { - "line": 237, - "column": 3, - "index": 6588 - } - }, - "context": { - "loc": { - "start": { - "line": 238, - "column": 2, - "index": 6591 - }, - "end": { - "line": 240, - "column": 3, - "index": 6629 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 242, - "column": 2, - "index": 6633 - }, - "end": { - "line": 282, - "column": 3, - "index": 7805 - } - }, - "context": { - "loc": { - "start": { - "line": 283, - "column": 2, - "index": 7808 - }, - "end": { - "line": 301, - "column": 3, - "index": 8272 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 10, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 303, - "column": 2, - "index": 8276 - }, - "end": { - "line": 348, - "column": 3, - "index": 9683 - } - }, - "context": { - "loc": { - "start": { - "line": 349, - "column": 2, - "index": 9686 - }, - "end": { - "line": 366, - "column": 3, - "index": 10136 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "TableRow object", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 368, - "column": 2, - "index": 10140 - }, - "end": { - "line": 407, - "column": 3, - "index": 11362 - } - }, - "context": { - "loc": { - "start": { - "line": 408, - "column": 2, - "index": 11365 - }, - "end": { - "line": 423, - "column": 3, - "index": 11778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "TableRow object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 425, - "column": 2, - "index": 11782 - }, - "end": { - "line": 472, - "column": 3, - "index": 13226 - } - }, - "context": { - "loc": { - "start": { - "line": 473, - "column": 2, - "index": 13229 - }, - "end": { - "line": 489, - "column": 3, - "index": 13668 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all values in the specified column, and returns them\nas an array. The column may be specified by either its ID or title." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String or Number of the column to return", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "Array of column values", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 491, - "column": 2, - "index": 13672 - }, - "end": { - "line": 525, - "column": 3, - "index": 14658 - } - }, - "context": { - "loc": { - "start": { - "line": 526, - "column": 2, - "index": 14661 - }, - "end": { - "line": 538, - "column": 3, - "index": 14980 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 526 - }, - { - "title": "param", - "name": "column", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String or Number of the column to return" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of column values" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes all rows from a Table. While all rows are removed,\ncolumns and column titles are maintained." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 540, - "column": 2, - "index": 14984 - }, - "end": { - "line": 571, - "column": 3, - "index": 15789 - } - }, - "context": { - "loc": { - "start": { - "line": 572, - "column": 2, - "index": 15792 - }, - "end": { - "line": 575, - "column": 3, - "index": 15852 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clearRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "clearRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#clearRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new column to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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.)" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "title of the given column", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "title" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 577, - "column": 2, - "index": 15856 - }, - "end": { - "line": 619, - "column": 3, - "index": 17079 - } - }, - "context": { - "loc": { - "start": { - "line": 620, - "column": 2, - "index": 17082 - }, - "end": { - "line": 623, - "column": 3, - "index": 17160 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "title", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "title of the given column" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of columns in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of columns in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 625, - "column": 2, - "index": 17164 - }, - "end": { - "line": 655, - "column": 3, - "index": 17854 - } - }, - "context": { - "loc": { - "start": { - "line": 656, - "column": 2, - "index": 17857 - }, - "end": { - "line": 658, - "column": 3, - "index": 17912 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of columns in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumnCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumnCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumnCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of rows in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of rows in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 660, - "column": 2, - "index": 17916 - }, - "end": { - "line": 690, - "column": 3, - "index": 18564 - } - }, - "context": { - "loc": { - "start": { - "line": 691, - "column": 2, - "index": 18567 - }, - "end": { - "line": 693, - "column": 3, - "index": 18616 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of rows in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRowCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRowCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRowCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes any of the specified characters (or \"tokens\")." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String listing characters to be removed", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "chars" - }, - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 695, - "column": 2, - "index": 18620 - }, - "end": { - "line": 730, - "column": 3, - "index": 19601 - } - }, - "context": { - "loc": { - "start": { - "line": 731, - "column": 2, - "index": 19604 - }, - "end": { - "line": 764, - "column": 3, - "index": 20779 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "chars", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String listing characters to be removed" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeTokens", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeTokens", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeTokens" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 766, - "column": 2, - "index": 20783 - }, - "end": { - "line": 798, - "column": 3, - "index": 21711 - } - }, - "context": { - "loc": { - "start": { - "line": 799, - "column": 2, - "index": 21714 - }, - "end": { - "line": 827, - "column": 3, - "index": 22666 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "trim", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "trim", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#trim" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "removeColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "columnName (string) or ID (number)", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 829, - "column": 2, - "index": 22670 - }, - "end": { - "line": 864, - "column": 3, - "index": 23691 - } - }, - "context": { - "loc": { - "start": { - "line": 865, - "column": 2, - "index": 23694 - }, - "end": { - "line": 888, - "column": 3, - "index": 24362 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "c", - "lineNumber": 865 - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or ID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 890, - "column": 2, - "index": 24366 - }, - "end": { - "line": 932, - "column": 3, - "index": 25518 - } - }, - "context": { - "loc": { - "start": { - "line": 933, - "column": 2, - "index": 25521 - }, - "end": { - "line": 935, - "column": 3, - "index": 25590 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "set", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "set", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#set" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 937, - "column": 2, - "index": 25594 - }, - "end": { - "line": 976, - "column": 3, - "index": 26578 - } - }, - "context": { - "loc": { - "start": { - "line": 977, - "column": 2, - "index": 26581 - }, - "end": { - "line": 979, - "column": 3, - "index": 26656 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 981, - "column": 2, - "index": 26660 - }, - "end": { - "line": 1019, - "column": 3, - "index": 27767 - } - }, - "context": { - "loc": { - "start": { - "line": 1020, - "column": 2, - "index": 27770 - }, - "end": { - "line": 1022, - "column": 3, - "index": 27851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1024, - "column": 2, - "index": 27855 - }, - "end": { - "line": 1062, - "column": 3, - "index": 28842 - } - }, - "context": { - "loc": { - "start": { - "line": 1063, - "column": 2, - "index": 28845 - }, - "end": { - "line": 1065, - "column": 3, - "index": 28907 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "get", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "get", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#get" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1067, - "column": 2, - "index": 28911 - }, - "end": { - "line": 1103, - "column": 3, - "index": 29853 - } - }, - "context": { - "loc": { - "start": { - "line": 1104, - "column": 2, - "index": 29856 - }, - "end": { - "line": 1106, - "column": 3, - "index": 29924 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1108, - "column": 2, - "index": 29928 - }, - "end": { - "line": 1151, - "column": 3, - "index": 31214 - } - }, - "context": { - "loc": { - "start": { - "line": 1153, - "column": 2, - "index": 31218 - }, - "end": { - "line": 1155, - "column": 3, - "index": 31292 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Name of the column which should be used to\n title each row object (optional)", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "headerColumn" - }, - { - "title": "return", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 1157, - "column": 2, - "index": 31296 - }, - "end": { - "line": 1195, - "column": 3, - "index": 32265 - } - }, - "context": { - "loc": { - "start": { - "line": 1196, - "column": 2, - "index": 32268 - }, - "end": { - "line": 1216, - "column": 3, - "index": 32851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "headerColumn", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Name of the column which should be used to\ntitle each row object (optional)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getObject", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getObject", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getObject" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all table data and returns it as a multidimensional array." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 1218, - "column": 2, - "index": 32855 - }, - "end": { - "line": 1251, - "column": 3, - "index": 33622 - } - }, - "context": { - "loc": { - "start": { - "line": 1252, - "column": 2, - "index": 33625 - }, - "end": { - "line": 1258, - "column": 3, - "index": 33788 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getArray", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getArray" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - } - ], - "namespace": "p5.Table" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An internal class to store data that will be sent to a p5.RenderBuffer.\nThose need to eventually go into a Float32Array, so this class provides a\nvariable-length array container backed by a Float32Array so that it can be\nsent to the GPU without allocating a new array each frame." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Like a C++ vector, its fixed-length Float32Array backing its contents will\ndouble in size when it goes over its capacity." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 3, - "column": 0, - "index": 32 - }, - "end": { - "line": 27, - "column": 3, - "index": 926 - } - }, - "context": { - "loc": { - "start": { - "line": 28, - "column": 0, - "index": 927 - }, - "end": { - "line": 108, - "column": 2, - "index": 2998 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "DataArray", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a Float32Array window sized to the exact length of the data" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 35, - "column": 2, - "index": 1114 - }, - "end": { - "line": 37, - "column": 5, - "index": 1196 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 2, - "index": 1199 - }, - "end": { - "line": 40, - "column": 3, - "index": 1258 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dataArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "dataArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#dataArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A \"soft\" clear, which keeps the underlying storage size the same, but\nempties the contents of its dataArray()" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 42, - "column": 2, - "index": 1262 - }, - "end": { - "line": 45, - "column": 5, - "index": 1391 - } - }, - "context": { - "loc": { - "start": { - "line": 46, - "column": 2, - "index": 1394 - }, - "end": { - "line": 48, - "column": 3, - "index": 1428 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clear", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "clear", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#clear" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Can be used to scale a DataArray back down to fit its contents." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 50, - "column": 2, - "index": 1432 - }, - "end": { - "line": 52, - "column": 5, - "index": 1510 - } - }, - "context": { - "loc": { - "start": { - "line": 53, - "column": 2, - "index": 1513 - }, - "end": { - "line": 61, - "column": 3, - "index": 1839 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rescale", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "rescale", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#rescale" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A full reset, which allocates a new underlying Float32Array at its initial\nlength" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 63, - "column": 2, - "index": 1843 - }, - "end": { - "line": 66, - "column": 5, - "index": 1944 - } - }, - "context": { - "loc": { - "start": { - "line": 67, - "column": 2, - "index": 1947 - }, - "end": { - "line": 70, - "column": 3, - "index": 2032 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "reset", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "reset", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#reset" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Adds values to the DataArray, expanding its internal storage to\naccommodate the new items." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 72, - "column": 2, - "index": 2036 - }, - "end": { - "line": 75, - "column": 5, - "index": 2146 - } - }, - "context": { - "loc": { - "start": { - "line": 76, - "column": 2, - "index": 2149 - }, - "end": { - "line": 80, - "column": 3, - "index": 2296 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "values", - "lineNumber": 76, - "type": { - "type": "RestType" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "push", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "push", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#push" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a copy of the data from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to the index\n" - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 82, - "column": 2, - "index": 2300 - }, - "end": { - "line": 85, - "column": 5, - "index": 2409 - } - }, - "context": { - "loc": { - "start": { - "line": 86, - "column": 2, - "index": 2412 - }, - "end": { - "line": 88, - "column": 3, - "index": 2494 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 86 - }, - { - "title": "param", - "name": "to", - "lineNumber": 86 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "slice", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "slice", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#slice" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a mutable Float32Array window from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to\nthe index " - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 90, - "column": 2, - "index": 2498 - }, - "end": { - "line": 93, - "column": 5, - "index": 2618 - } - }, - "context": { - "loc": { - "start": { - "line": 94, - "column": 2, - "index": 2621 - }, - "end": { - "line": 96, - "column": 3, - "index": 2709 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 94 - }, - { - "title": "param", - "name": "to", - "lineNumber": 94 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "subArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "subArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#subArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Expand capacity of the internal storage until it can fit a target size" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 98, - "column": 2, - "index": 2713 - }, - "end": { - "line": 100, - "column": 5, - "index": 2798 - } - }, - "context": { - "loc": { - "start": { - "line": 101, - "column": 2, - "index": 2801 - }, - "end": { - "line": 107, - "column": 3, - "index": 2995 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "target", - "lineNumber": 101 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "ensureLength", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "ensureLength", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#ensureLength" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - } - ], - "namespace": "p5.DataArray" - } - ] - }, - "path": [ - { - "name": "p5" - } - ], - "namespace": "p5" - }, - { - "description": "", - "tags": [ - { - "title": "for", - "description": "p5", - "lineNumber": 1 - }, - { - "title": "requires", - "description": null, - "lineNumber": 2, - "name": "core", - "errors": [ - "Unknown content 'These are functions that are part of the Processing API but are not part of\nthe p5.js API. In some cases they have a new name, in others, they are\nremoved completely. Not all unsupported Processing functions are listed here\nbut we try to include ones that a user coming from Processing might likely\ncall.'" - ] - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 9, - "column": 3, - "index": 356 - } - }, - "context": { - "loc": { - "start": { - "line": 11, - "column": 0, - "index": 358 - }, - "end": { - "line": 11, - "column": 24, - "index": 382 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/legacy.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "p5", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the number of frames drawn since the sketch started." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "frameCount" - }, - { - "type": "text", - "value": "'s value is 0 inside " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". It\nincrements by 1 each time the code in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfinishes executing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "frameCount" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 69, - "column": 0, - "index": 1553 - }, - "end": { - "line": 116, - "column": 3, - "index": 2581 - } - }, - "context": { - "loc": { - "start": { - "line": 117, - "column": 0, - "index": 2582 - }, - "end": { - "line": 117, - "column": 28, - "index": 2610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "frameCount", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "frameCount", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "frameCount", - "scope": "instance" - } - ], - "namespace": "p5#frameCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the amount of time, in milliseconds, it took for\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to draw the previous frame. " - }, - { - "type": "inlineCode", - "value": "deltaTime" - }, - { - "type": "text", - "value": " is\nuseful for simulating physics." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "deltaTime" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 2612 - }, - "end": { - "line": 161, - "column": 3, - "index": 3539 - } - }, - "context": { - "loc": { - "start": { - "line": 162, - "column": 0, - "index": 3540 - }, - "end": { - "line": 162, - "column": 27, - "index": 3567 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deltaTime", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deltaTime", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deltaTime", - "scope": "instance" - } - ], - "namespace": "p5#deltaTime" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks whether the browser window is focused and can receive user input.\n" - }, - { - "type": "inlineCode", - "value": "focused" - }, - { - "type": "text", - "value": " is " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": " if the window if focused and " - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "focused" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 164, - "column": 0, - "index": 3569 - }, - "end": { - "line": 190, - "column": 3, - "index": 4257 - } - }, - "context": { - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 4258 - }, - "end": { - "line": 191, - "column": 43, - "index": 4301 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "focused", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "focused", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "focused", - "scope": "instance" - } - ], - "namespace": "p5#focused" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A string variable with the WebGL version in use. Its value equals one of\nthe followin string constants:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL2" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl2'" - }, - { - "type": "text", - "value": "," - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl'" - }, - { - "type": "text", - "value": ", or" - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "P2D" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'p2d'" - }, - { - "type": "text", - "value": ". This is the default for 2D sketches." - } - ] - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setAttributes()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for ways to set the\nWebGL version." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - }, - "name": "webglVersion" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 12 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 466, - "column": 0, - "index": 12055 - }, - "end": { - "line": 544, - "column": 3, - "index": 13784 - } - }, - "context": { - "loc": { - "start": { - "line": 545, - "column": 0, - "index": 13785 - }, - "end": { - "line": 545, - "column": 34, - "index": 13819 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "webglVersion", - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "webglVersion", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "webglVersion", - "scope": "instance" - } - ], - "namespace": "p5#webglVersion" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayWidth" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen width can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayWidth * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 547, - "column": 0, - "index": 13821 - }, - "end": { - "line": 574, - "column": 3, - "index": 14559 - } - }, - "context": { - "loc": { - "start": { - "line": 575, - "column": 0, - "index": 14560 - }, - "end": { - "line": 575, - "column": 41, - "index": 14601 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayWidth", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayWidth", - "scope": "instance" - } - ], - "namespace": "p5#displayWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayHeight" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen height can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayHeight * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 577, - "column": 0, - "index": 14603 - }, - "end": { - "line": 604, - "column": 3, - "index": 15346 - } - }, - "context": { - "loc": { - "start": { - "line": 605, - "column": 0, - "index": 15347 - }, - "end": { - "line": 605, - "column": 43, - "index": 15390 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayHeight", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayHeight", - "scope": "instance" - } - ], - "namespace": "p5#displayHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 607, - "column": 0, - "index": 15392 - }, - "end": { - "line": 631, - "column": 3, - "index": 16081 - } - }, - "context": { - "loc": { - "start": { - "line": 632, - "column": 0, - "index": 16082 - }, - "end": { - "line": 632, - "column": 44, - "index": 16126 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowWidth", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowWidth", - "scope": "instance" - } - ], - "namespace": "p5#windowWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 634, - "column": 0, - "index": 16128 - }, - "end": { - "line": 658, - "column": 3, - "index": 16819 - } - }, - "context": { - "loc": { - "start": { - "line": 659, - "column": 0, - "index": 16820 - }, - "end": { - "line": 659, - "column": 46, - "index": 16866 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowHeight", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowHeight", - "scope": "instance" - } - ], - "namespace": "p5#windowHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "width" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "width" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 750, - "column": 0, - "index": 19217 - }, - "end": { - "line": 816, - "column": 3, - "index": 20713 - } - }, - "context": { - "loc": { - "start": { - "line": 817, - "column": 0, - "index": 20714 - }, - "end": { - "line": 817, - "column": 23, - "index": 20737 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "width", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "width", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "width", - "scope": "instance" - } - ], - "namespace": "p5#width" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "height" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "height" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 819, - "column": 0, - "index": 20739 - }, - "end": { - "line": 885, - "column": 3, - "index": 22246 - } - }, - "context": { - "loc": { - "start": { - "line": 886, - "column": 0, - "index": 22247 - }, - "end": { - "line": 886, - "column": 24, - "index": 22271 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "height", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "height", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "height", - "scope": "instance" - } - ], - "namespace": "p5#height" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "nothing displayed", - "lineNumber": 20 - } - ], - "loc": { - "start": { - "line": 317, - "column": 4, - "index": 10982 - }, - "end": { - "line": 340, - "column": 7, - "index": 11811 - } - }, - "context": { - "loc": { - "start": { - "line": 341, - "column": 4, - "index": 11816 - }, - "end": { - "line": 402, - "column": 6, - "index": 13726 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "remove", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "remove", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#remove" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function does 3 things:" - } - ] - }, - { - "type": "list", - "ordered": true, - "start": 1, - "spread": true, - "children": [ - { - "type": "listItem", - "spread": true, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Bounds the desired start/stop angles for an arc (in radians) so that:" - } - ] - }, - { - "type": "code", - "lang": null, - "meta": null, - "value": "0 <= start < TWO_PI ; start <= stop < start + TWO_PI" - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This means that the arc rendering functions don't have to be concerned\nwith what happens if stop is smaller than start, or if the arc 'goes\nround more than once', etc.: they can just start at start and increase\nuntil stop and the correct arc will be drawn." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Optionally adjusts the angles within each quadrant to counter the naive\nscaling of the underlying ellipse up from the unit circle. Without\nthis, the angles become arbitrary when width != height: 45 degrees\nmight be drawn at 5 degrees on a 'wide' ellipse, or at 85 degrees on\na 'tall' ellipse." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Flags up when start and stop correspond to the same place on the\nunderlying ellipse. This is useful if you want to do something special\nthere (like rendering a whole ellipse instead)." - } - ] - } - ] - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 16, - "column": 0, - "index": 333 - }, - "end": { - "line": 37, - "column": 3, - "index": 1365 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 1366 - }, - "end": { - "line": 100, - "column": 2, - "index": 3623 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "start", - "lineNumber": 39 - }, - { - "title": "param", - "name": "stop", - "lineNumber": 40 - }, - { - "title": "param", - "name": "width", - "lineNumber": 41 - }, - { - "title": "param", - "name": "height", - "lineNumber": 42 - }, - { - "title": "param", - "name": "correctForScaling", - "lineNumber": 43 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_normalizeArcAngles", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_normalizeArcAngles", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_normalizeArcAngles" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for select and selectAll" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 6392 - }, - "end": { - "line": 193, - "column": 3, - "index": 6443 - } - }, - "context": { - "loc": { - "start": { - "line": 194, - "column": 0, - "index": 6444 - }, - "end": { - "line": 204, - "column": 2, - "index": 6751 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "p", - "lineNumber": 194 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_getContainer", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_getContainer", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_getContainer" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for getElement and getElements." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 206, - "column": 0, - "index": 6753 - }, - "end": { - "line": 208, - "column": 3, - "index": 6811 - } - }, - "context": { - "loc": { - "start": { - "line": 209, - "column": 0, - "index": 6812 - }, - "end": { - "line": 238, - "column": 2, - "index": 7767 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "elt", - "lineNumber": 209 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_wrapElement", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_wrapElement", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_wrapElement" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "INPUT *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 715, - "column": 0, - "index": 21883 - }, - "end": { - "line": 715, - "column": 13, - "index": 21896 - } - }, - "context": { - "loc": { - "start": { - "line": 827, - "column": 0, - "index": 24953 - }, - "end": { - "line": 840, - "column": 2, - "index": 25384 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "min", - "lineNumber": 827 - }, - { - "title": "param", - "name": "max", - "lineNumber": 827 - }, - { - "title": "param", - "name": "value", - "lineNumber": 827 - }, - { - "title": "param", - "name": "step", - "lineNumber": 827 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createSlider", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createSlider", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createSlider" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "AUDIO STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2041, - "column": 0, - "index": 61417 - }, - "end": { - "line": 2041, - "column": 19, - "index": 61436 - } - }, - "context": { - "loc": { - "start": { - "line": 2080, - "column": 0, - "index": 62975 - }, - "end": { - "line": 2083, - "column": 2, - "index": 63135 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "src", - "lineNumber": 2080 - }, - { - "title": "param", - "name": "callback", - "lineNumber": 2080 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createAudio", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createAudio", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createAudio" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "CAMERA STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2085, - "column": 0, - "index": 63137 - }, - "end": { - "line": 2085, - "column": 20, - "index": 63157 - } - }, - "context": { - "loc": { - "start": { - "line": 2087, - "column": 0, - "index": 63159 - }, - "end": { - "line": 2087, - "column": 29, - "index": 63188 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "VIDEO", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "VIDEO", - "scope": "instance" - } - ], - "namespace": "p5#VIDEO" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - }, - "name": "deviceOrientation" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 20, - "column": 3, - "index": 511 - } - }, - "context": { - "loc": { - "start": { - "line": 21, - "column": 0, - "index": 512 - }, - "end": { - "line": 22, - "column": 74, - "index": 619 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deviceOrientation", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deviceOrientation", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deviceOrientation", - "scope": "instance" - } - ], - "namespace": "p5#deviceOrientation" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationX always contains the acceleration of the\ndevice along the x axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 24, - "column": 0, - "index": 621 - }, - "end": { - "line": 43, - "column": 3, - "index": 1167 - } - }, - "context": { - "loc": { - "start": { - "line": 44, - "column": 0, - "index": 1168 - }, - "end": { - "line": 44, - "column": 31, - "index": 1199 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationX", - "scope": "instance" - } - ], - "namespace": "p5#accelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationY always contains the acceleration of the\ndevice along the y axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 46, - "column": 0, - "index": 1201 - }, - "end": { - "line": 65, - "column": 3, - "index": 1746 - } - }, - "context": { - "loc": { - "start": { - "line": 66, - "column": 0, - "index": 1747 - }, - "end": { - "line": 66, - "column": 31, - "index": 1778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationY", - "scope": "instance" - } - ], - "namespace": "p5#accelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationZ always contains the acceleration of the\ndevice along the z axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 68, - "column": 0, - "index": 1780 - }, - "end": { - "line": 88, - "column": 3, - "index": 2328 - } - }, - "context": { - "loc": { - "start": { - "line": 89, - "column": 0, - "index": 2329 - }, - "end": { - "line": 89, - "column": 31, - "index": 2360 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationZ", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#accelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 91, - "column": 0, - "index": 2362 - }, - "end": { - "line": 98, - "column": 3, - "index": 2625 - } - }, - "context": { - "loc": { - "start": { - "line": 99, - "column": 0, - "index": 2626 - }, - "end": { - "line": 99, - "column": 32, - "index": 2658 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationX", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationX", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 101, - "column": 0, - "index": 2660 - }, - "end": { - "line": 108, - "column": 3, - "index": 2923 - } - }, - "context": { - "loc": { - "start": { - "line": 109, - "column": 0, - "index": 2924 - }, - "end": { - "line": 109, - "column": 32, - "index": 2956 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationY", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationY", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 111, - "column": 0, - "index": 2958 - }, - "end": { - "line": 118, - "column": 3, - "index": 3221 - } - }, - "context": { - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 3222 - }, - "end": { - "line": 119, - "column": 32, - "index": 3254 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationZ", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationX always contains the rotation of the\ndevice along the x axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES, the value will be -180 to 180. If\nit is set to RADIANS, the value will be -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 132, - "column": 0, - "index": 3568 - }, - "end": { - "line": 162, - "column": 3, - "index": 4447 - } - }, - "context": { - "loc": { - "start": { - "line": 163, - "column": 0, - "index": 4448 - }, - "end": { - "line": 163, - "column": 27, - "index": 4475 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationX", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationX", - "scope": "instance" - } - ], - "namespace": "p5#rotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationY always contains the rotation of the\ndevice along the y axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 165, - "column": 0, - "index": 4477 - }, - "end": { - "line": 195, - "column": 3, - "index": 5358 - } - }, - "context": { - "loc": { - "start": { - "line": 196, - "column": 0, - "index": 5359 - }, - "end": { - "line": 196, - "column": 27, - "index": 5386 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationY", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationY", - "scope": "instance" - } - ], - "namespace": "p5#rotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationZ always contains the rotation of the\ndevice along the z axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Unlike rotationX and rotationY, this variable is available for devices\nwith a built-in compass only." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - }, - { - "title": "property", - "description": null, - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 33 - } - ], - "loc": { - "start": { - "line": 198, - "column": 0, - "index": 5388 - }, - "end": { - "line": 232, - "column": 3, - "index": 6377 - } - }, - "context": { - "loc": { - "start": { - "line": 233, - "column": 0, - "index": 6378 - }, - "end": { - "line": 233, - "column": 27, - "index": 6405 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationZ", - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationZ", - "scope": "instance" - } - ], - "namespace": "p5#rotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES,\nthe value will be -180 to 180. If it is set to RADIANS, the value will\nbe -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationX can also be used with rotationX to determine the rotate\ndirection of the device along the X-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 40 - } - ], - "loc": { - "start": { - "line": 235, - "column": 0, - "index": 6407 - }, - "end": { - "line": 276, - "column": 3, - "index": 7745 - } - }, - "context": { - "loc": { - "start": { - "line": 277, - "column": 0, - "index": 7746 - }, - "end": { - "line": 277, - "column": 28, - "index": 7774 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationX", - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationX", - "scope": "instance" - } - ], - "namespace": "p5#pRotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationY can also be used with rotationY to determine the rotate\ndirection of the device along the Y-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 39 - } - ], - "loc": { - "start": { - "line": 279, - "column": 0, - "index": 7776 - }, - "end": { - "line": 319, - "column": 3, - "index": 9113 - } - }, - "context": { - "loc": { - "start": { - "line": 320, - "column": 0, - "index": 9114 - }, - "end": { - "line": 320, - "column": 28, - "index": 9142 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationY", - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationY", - "scope": "instance" - } - ], - "namespace": "p5#pRotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationZ can also be used with rotationZ to determine the rotate\ndirection of the device along the Z-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 35 - } - ], - "loc": { - "start": { - "line": 322, - "column": 0, - "index": 9144 - }, - "end": { - "line": 358, - "column": 3, - "index": 10350 - } - }, - "context": { - "loc": { - "start": { - "line": 359, - "column": 0, - "index": 10351 - }, - "end": { - "line": 359, - "column": 28, - "index": 10379 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationZ", - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationZ", - "scope": "instance" - } - ], - "namespace": "p5#pRotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When a device is rotated, the axis that triggers the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "deviceTurned()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nmethod is stored in the turnAxis variable. The turnAxis variable is only defined within\nthe scope of deviceTurned()." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "turnAxis" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 379, - "column": 0, - "index": 10890 - }, - "end": { - "line": 412, - "column": 3, - "index": 11826 - } - }, - "context": { - "loc": { - "start": { - "line": 413, - "column": 0, - "index": 11827 - }, - "end": { - "line": 413, - "column": 34, - "index": 11861 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "turnAxis", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "turnAxis", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "turnAxis", - "scope": "instance" - } - ], - "namespace": "p5#turnAxis" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyIsPressed" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is true if any key is pressed\nand false if no keys are pressed." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "keyIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 111 - }, - "end": { - "line": 30, - "column": 3, - "index": 575 - } - }, - "context": { - "loc": { - "start": { - "line": 31, - "column": 0, - "index": 576 - }, - "end": { - "line": 31, - "column": 34, - "index": 610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "isKeyPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "isKeyPressed", - "scope": "instance" - } - ], - "namespace": "p5#isKeyPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyTyped()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". For non-ASCII keys, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyCode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nvariable." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "key" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 34, - "column": 0, - "index": 655 - }, - "end": { - "line": 57, - "column": 3, - "index": 1373 - } - }, - "context": { - "loc": { - "start": { - "line": 58, - "column": 0, - "index": 1374 - }, - "end": { - "line": 58, - "column": 22, - "index": 1396 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "key", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "key", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "key", - "scope": "instance" - } - ], - "namespace": "p5#key" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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: " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keycode.info" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "keyCode" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 60, - "column": 0, - "index": 1398 - }, - "end": { - "line": 95, - "column": 3, - "index": 2425 - } - }, - "context": { - "loc": { - "start": { - "line": 96, - "column": 0, - "index": 2426 - }, - "end": { - "line": 96, - "column": 25, - "index": 2451 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyCode", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "keyCode", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "keyCode", - "scope": "instance" - } - ], - "namespace": "p5#keyCode" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The onblur function is called when the user is no longer focused\non the p5 element. Because the keyup events will not fire if the user is\nnot focused on the element we must assume all keys currently down have\nbeen released." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 291, - "column": 0, - "index": 8735 - }, - "end": { - "line": 296, - "column": 3, - "index": 8978 - } - }, - "context": { - "loc": { - "start": { - "line": 297, - "column": 0, - "index": 8979 - }, - "end": { - "line": 299, - "column": 2, - "index": 9041 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "e", - "lineNumber": 297 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_onblur", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_onblur", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_onblur" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedX contains the horizontal movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 4 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 40, - "column": 3, - "index": 777 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 778 - }, - "end": { - "line": 41, - "column": 24, - "index": 802 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedX", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedX", - "scope": "instance" - } - ], - "namespace": "p5#movedX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedY contains the vertical movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 43, - "column": 0, - "index": 804 - }, - "end": { - "line": 70, - "column": 3, - "index": 1394 - } - }, - "context": { - "loc": { - "start": { - "line": 71, - "column": 0, - "index": 1395 - }, - "end": { - "line": 71, - "column": 24, - "index": 1419 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedY", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedY", - "scope": "instance" - } - ], - "namespace": "p5#movedY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 80, - "column": 0, - "index": 1666 - }, - "end": { - "line": 101, - "column": 3, - "index": 2316 - } - }, - "context": { - "loc": { - "start": { - "line": 102, - "column": 0, - "index": 2317 - }, - "end": { - "line": 102, - "column": 24, - "index": 2341 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseX", - "scope": "instance" - } - ], - "namespace": "p5#mouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 2343 - }, - "end": { - "line": 125, - "column": 3, - "index": 2986 - } - }, - "context": { - "loc": { - "start": { - "line": 126, - "column": 0, - "index": 2987 - }, - "end": { - "line": 126, - "column": 24, - "index": 3011 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseY", - "scope": "instance" - } - ], - "namespace": "p5#mouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 128, - "column": 0, - "index": 3013 - }, - "end": { - "line": 156, - "column": 3, - "index": 3890 - } - }, - "context": { - "loc": { - "start": { - "line": 157, - "column": 0, - "index": 3891 - }, - "end": { - "line": 157, - "column": 25, - "index": 3916 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseX", - "scope": "instance" - } - ], - "namespace": "p5#pmouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 159, - "column": 0, - "index": 3918 - }, - "end": { - "line": 186, - "column": 3, - "index": 4745 - } - }, - "context": { - "loc": { - "start": { - "line": 187, - "column": 0, - "index": 4746 - }, - "end": { - "line": 187, - "column": 25, - "index": 4771 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseY", - "scope": "instance" - } - ], - "namespace": "p5#pmouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseX always contains the current horizontal\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 189, - "column": 0, - "index": 4773 - }, - "end": { - "line": 223, - "column": 3, - "index": 5653 - } - }, - "context": { - "loc": { - "start": { - "line": 224, - "column": 0, - "index": 5654 - }, - "end": { - "line": 224, - "column": 27, - "index": 5681 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseX", - "scope": "instance" - } - ], - "namespace": "p5#winMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseY always contains the current vertical\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 226, - "column": 0, - "index": 5683 - }, - "end": { - "line": 260, - "column": 3, - "index": 6560 - } - }, - "context": { - "loc": { - "start": { - "line": 261, - "column": 0, - "index": 6561 - }, - "end": { - "line": 261, - "column": 27, - "index": 6588 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseY", - "scope": "instance" - } - ], - "namespace": "p5#winMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 263, - "column": 0, - "index": 6590 - }, - "end": { - "line": 299, - "column": 3, - "index": 7675 - } - }, - "context": { - "loc": { - "start": { - "line": 300, - "column": 0, - "index": 7676 - }, - "end": { - "line": 300, - "column": 28, - "index": 7704 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseX", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseX", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 302, - "column": 0, - "index": 7706 - }, - "end": { - "line": 338, - "column": 3, - "index": 8785 - } - }, - "context": { - "loc": { - "start": { - "line": 339, - "column": 0, - "index": 8786 - }, - "end": { - "line": 339, - "column": 28, - "index": 8814 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseY", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseY", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - }, - "name": "mouseButton" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 341, - "column": 0, - "index": 8816 - }, - "end": { - "line": 375, - "column": 3, - "index": 9715 - } - }, - "context": { - "loc": { - "start": { - "line": 376, - "column": 0, - "index": 9716 - }, - "end": { - "line": 376, - "column": 29, - "index": 9745 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseButton", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseButton", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseButton", - "scope": "instance" - } - ], - "namespace": "p5#mouseButton" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable mouseIsPressed is true if the mouse is pressed\nand false if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "mouseIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 378, - "column": 0, - "index": 9747 - }, - "end": { - "line": 404, - "column": 3, - "index": 10289 - } - }, - "context": { - "loc": { - "start": { - "line": 405, - "column": 0, - "index": 10290 - }, - "end": { - "line": 405, - "column": 36, - "index": 10326 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseIsPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseIsPressed", - "scope": "instance" - } - ], - "namespace": "p5#mouseIsPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The touches[] array is not supported on Safari and IE on touch-based\ndesktops (laptops)." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - }, - "name": "touches" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 108 - }, - "end": { - "line": 37, - "column": 3, - "index": 883 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 884 - }, - "end": { - "line": 38, - "column": 26, - "index": 910 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/touch.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "touches", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "touches", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "touches", - "scope": "instance" - } - ], - "namespace": "p5#touches" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An array containing the color of each pixel on the canvas. Colors are\nstored as numbers representing red, green, blue, and alpha (RGBA) values.\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " is a one-dimensional array for performance reasons." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Each pixel occupies four elements in the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array, one for each RGBA\nvalue. For example, the pixel at coordinates (0, 0) stores its RGBA values\nat " - }, - { - "type": "inlineCode", - "value": "pixels[0]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[1]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[2]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[3]" - }, - { - "type": "text", - "value": ", respectively.\nThe next pixel at coordinates (1, 0) stores its RGBA values at " - }, - { - "type": "inlineCode", - "value": "pixels[4]" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "inlineCode", - "value": "pixels[5]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[6]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[7]" - }, - { - "type": "text", - "value": ". And so on. The " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array\nfor a 100×100 canvas has 100 × 100 × 4 = 40,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Some displays use several smaller pixels to set the color at a single\npoint. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function returns\nthe pixel density of the canvas. High density displays often have a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " of 2. On such a display, the\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array for a 100×100 canvas has 200 × 200 × 4 =\n160,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Accessing the RGBA values for a point on the canvas requires a little math\nas shown below. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadPixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function\nmust be called before accessing the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array. The\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "updatePixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function must be called\nafter any changes are made." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "pixels" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 169 - }, - "end": { - "line": 103, - "column": 3, - "index": 3031 - } - }, - "context": { - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 3032 - }, - "end": { - "line": 104, - "column": 25, - "index": 3057 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pixels", - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pixels", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pixels", - "scope": "instance" - } - ], - "namespace": "p5#pixels" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function to measure ascent and descent." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 362, - "column": 0, - "index": 9474 - }, - "end": { - "line": 364, - "column": 3, - "index": 9531 - } - }, - "context": { - "loc": { - "start": { - "line": 365, - "column": 0, - "index": 9532 - }, - "end": { - "line": 367, - "column": 2, - "index": 9627 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_updateTextMetrics", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_updateTextMetrics", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_updateTextMetrics" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ensures that p5 is using a 3d renderer. throws an error if not." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2350, - "column": 0, - "index": 73393 - }, - "end": { - "line": 2352, - "column": 3, - "index": 73467 - } - }, - "context": { - "loc": { - "start": { - "line": 2353, - "column": 0, - "index": 73468 - }, - "end": { - "line": 2358, - "column": 2, - "index": 73742 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "name", - "lineNumber": 2353 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_assert3d", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_assert3d", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_assert3d" - } - ], - "events": [], - "static": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Turn off some features of the friendly error system (FES), which can give\na significant boost to performance when needed." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ndisabling the friendly error system" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "disableFriendlyErrors" - }, - { - "title": "example", - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 754, - "column": 0, - "index": 26038 - }, - "end": { - "line": 776, - "column": 3, - "index": 26889 - } - }, - "context": { - "loc": { - "start": { - "line": 777, - "column": 0, - "index": 26890 - }, - "end": { - "line": 777, - "column": 33, - "index": 26923 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "disableFriendlyErrors", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "disableFriendlyErrors", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "disableFriendlyErrors", - "scope": "static" - } - ], - "namespace": "p5.disableFriendlyErrors" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Path to the media element's source as a string." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.MediaElement", - "lineNumber": 3 - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "src" - }, - { - "title": "return", - "description": "src", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 4842, - "column": 0, - "index": 139686 - }, - "end": { - "line": 4868, - "column": 3, - "index": 140231 - } - }, - "context": { - "loc": { - "start": { - "line": 4958, - "column": 0, - "index": 142394 - }, - "end": { - "line": 5009, - "column": 2, - "index": 143967 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "src" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "File", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "File", - "scope": "static" - } - ], - "namespace": "p5.File" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Table Options\nGeneric class for handling tabular data, typically from a\nCSV, TSV, or other sort of spreadsheet file.\nCSV files are\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ncomma separated values" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", often with the data in quotes. TSV\nfiles use tabs as separators, and usually don't bother with the\nquotes.\nFile names should end with .csv if they're comma separated.\nA rough \"spec\" for CSV can be found\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "here" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nTo load files, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method.\nTo save tables to your computer, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "save" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method\nor the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "saveTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Possible options include:" - } - ] - }, - { - "type": "html", - "value": "
    \n
  • csv - parse the table as comma-separated values\n
  • tsv - parse the table as tab-separated values\n
  • header - this table has a header (title) row\n
" - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 93 - }, - "end": { - "line": 31, - "column": 3, - "index": 1053 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 1379 - }, - "end": { - "line": 1259, - "column": 2, - "index": 33791 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "Table", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addRow()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new row of data to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "set()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object is included as a parameter, then that row is\nduplicated and added to the table." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row to be added to the table", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - "name": "row" - }, - { - "title": "return", - "description": "the row that was added", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 47, - "column": 2, - "index": 1476 - }, - "end": { - "line": 94, - "column": 3, - "index": 2995 - } - }, - "context": { - "loc": { - "start": { - "line": 95, - "column": 2, - "index": 2998 - }, - "end": { - "line": 106, - "column": 3, - "index": 3319 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row to be added to the table" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the row that was added" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes a row from the table object." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to remove", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "id" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 108, - "column": 2, - "index": 3323 - }, - "end": { - "line": 145, - "column": 3, - "index": 4202 - } - }, - "context": { - "loc": { - "start": { - "line": 146, - "column": 2, - "index": 4205 - }, - "end": { - "line": 151, - "column": 3, - "index": 4410 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "id", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to remove" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a reference to the specified " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". The reference\ncan then be used to get and set values of the selected row." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to get", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "rowID" - }, - { - "title": "return", - "description": "p5.TableRow object", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 153, - "column": 2, - "index": 4414 - }, - "end": { - "line": 191, - "column": 3, - "index": 5463 - } - }, - "context": { - "loc": { - "start": { - "line": 192, - "column": 2, - "index": 5466 - }, - "end": { - "line": 194, - "column": 3, - "index": 5507 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "r", - "lineNumber": 192 - }, - { - "title": "param", - "name": "rowID", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to get" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Gets all rows from the table. Returns an array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Array of p5.TableRows", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 196, - "column": 2, - "index": 5511 - }, - "end": { - "line": 237, - "column": 3, - "index": 6588 - } - }, - "context": { - "loc": { - "start": { - "line": 238, - "column": 2, - "index": 6591 - }, - "end": { - "line": 240, - "column": 3, - "index": 6629 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 242, - "column": 2, - "index": 6633 - }, - "end": { - "line": 282, - "column": 3, - "index": 7805 - } - }, - "context": { - "loc": { - "start": { - "line": 283, - "column": 2, - "index": 7808 - }, - "end": { - "line": 301, - "column": 3, - "index": 8272 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 10, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 303, - "column": 2, - "index": 8276 - }, - "end": { - "line": 348, - "column": 3, - "index": 9683 - } - }, - "context": { - "loc": { - "start": { - "line": 349, - "column": 2, - "index": 9686 - }, - "end": { - "line": 366, - "column": 3, - "index": 10136 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "TableRow object", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 368, - "column": 2, - "index": 10140 - }, - "end": { - "line": 407, - "column": 3, - "index": 11362 - } - }, - "context": { - "loc": { - "start": { - "line": 408, - "column": 2, - "index": 11365 - }, - "end": { - "line": 423, - "column": 3, - "index": 11778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "TableRow object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 425, - "column": 2, - "index": 11782 - }, - "end": { - "line": 472, - "column": 3, - "index": 13226 - } - }, - "context": { - "loc": { - "start": { - "line": 473, - "column": 2, - "index": 13229 - }, - "end": { - "line": 489, - "column": 3, - "index": 13668 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all values in the specified column, and returns them\nas an array. The column may be specified by either its ID or title." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String or Number of the column to return", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "Array of column values", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 491, - "column": 2, - "index": 13672 - }, - "end": { - "line": 525, - "column": 3, - "index": 14658 - } - }, - "context": { - "loc": { - "start": { - "line": 526, - "column": 2, - "index": 14661 - }, - "end": { - "line": 538, - "column": 3, - "index": 14980 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 526 - }, - { - "title": "param", - "name": "column", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String or Number of the column to return" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of column values" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes all rows from a Table. While all rows are removed,\ncolumns and column titles are maintained." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 540, - "column": 2, - "index": 14984 - }, - "end": { - "line": 571, - "column": 3, - "index": 15789 - } - }, - "context": { - "loc": { - "start": { - "line": 572, - "column": 2, - "index": 15792 - }, - "end": { - "line": 575, - "column": 3, - "index": 15852 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clearRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "clearRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#clearRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new column to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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.)" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "title of the given column", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "title" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 577, - "column": 2, - "index": 15856 - }, - "end": { - "line": 619, - "column": 3, - "index": 17079 - } - }, - "context": { - "loc": { - "start": { - "line": 620, - "column": 2, - "index": 17082 - }, - "end": { - "line": 623, - "column": 3, - "index": 17160 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "title", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "title of the given column" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of columns in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of columns in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 625, - "column": 2, - "index": 17164 - }, - "end": { - "line": 655, - "column": 3, - "index": 17854 - } - }, - "context": { - "loc": { - "start": { - "line": 656, - "column": 2, - "index": 17857 - }, - "end": { - "line": 658, - "column": 3, - "index": 17912 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of columns in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumnCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumnCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumnCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of rows in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of rows in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 660, - "column": 2, - "index": 17916 - }, - "end": { - "line": 690, - "column": 3, - "index": 18564 - } - }, - "context": { - "loc": { - "start": { - "line": 691, - "column": 2, - "index": 18567 - }, - "end": { - "line": 693, - "column": 3, - "index": 18616 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of rows in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRowCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRowCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRowCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes any of the specified characters (or \"tokens\")." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String listing characters to be removed", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "chars" - }, - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 695, - "column": 2, - "index": 18620 - }, - "end": { - "line": 730, - "column": 3, - "index": 19601 - } - }, - "context": { - "loc": { - "start": { - "line": 731, - "column": 2, - "index": 19604 - }, - "end": { - "line": 764, - "column": 3, - "index": 20779 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "chars", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String listing characters to be removed" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeTokens", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeTokens", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeTokens" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 766, - "column": 2, - "index": 20783 - }, - "end": { - "line": 798, - "column": 3, - "index": 21711 - } - }, - "context": { - "loc": { - "start": { - "line": 799, - "column": 2, - "index": 21714 - }, - "end": { - "line": 827, - "column": 3, - "index": 22666 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "trim", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "trim", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#trim" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "removeColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "columnName (string) or ID (number)", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 829, - "column": 2, - "index": 22670 - }, - "end": { - "line": 864, - "column": 3, - "index": 23691 - } - }, - "context": { - "loc": { - "start": { - "line": 865, - "column": 2, - "index": 23694 - }, - "end": { - "line": 888, - "column": 3, - "index": 24362 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "c", - "lineNumber": 865 - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or ID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 890, - "column": 2, - "index": 24366 - }, - "end": { - "line": 932, - "column": 3, - "index": 25518 - } - }, - "context": { - "loc": { - "start": { - "line": 933, - "column": 2, - "index": 25521 - }, - "end": { - "line": 935, - "column": 3, - "index": 25590 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "set", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "set", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#set" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 937, - "column": 2, - "index": 25594 - }, - "end": { - "line": 976, - "column": 3, - "index": 26578 - } - }, - "context": { - "loc": { - "start": { - "line": 977, - "column": 2, - "index": 26581 - }, - "end": { - "line": 979, - "column": 3, - "index": 26656 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 981, - "column": 2, - "index": 26660 - }, - "end": { - "line": 1019, - "column": 3, - "index": 27767 - } - }, - "context": { - "loc": { - "start": { - "line": 1020, - "column": 2, - "index": 27770 - }, - "end": { - "line": 1022, - "column": 3, - "index": 27851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1024, - "column": 2, - "index": 27855 - }, - "end": { - "line": 1062, - "column": 3, - "index": 28842 - } - }, - "context": { - "loc": { - "start": { - "line": 1063, - "column": 2, - "index": 28845 - }, - "end": { - "line": 1065, - "column": 3, - "index": 28907 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "get", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "get", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#get" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1067, - "column": 2, - "index": 28911 - }, - "end": { - "line": 1103, - "column": 3, - "index": 29853 - } - }, - "context": { - "loc": { - "start": { - "line": 1104, - "column": 2, - "index": 29856 - }, - "end": { - "line": 1106, - "column": 3, - "index": 29924 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1108, - "column": 2, - "index": 29928 - }, - "end": { - "line": 1151, - "column": 3, - "index": 31214 - } - }, - "context": { - "loc": { - "start": { - "line": 1153, - "column": 2, - "index": 31218 - }, - "end": { - "line": 1155, - "column": 3, - "index": 31292 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Name of the column which should be used to\n title each row object (optional)", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "headerColumn" - }, - { - "title": "return", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 1157, - "column": 2, - "index": 31296 - }, - "end": { - "line": 1195, - "column": 3, - "index": 32265 - } - }, - "context": { - "loc": { - "start": { - "line": 1196, - "column": 2, - "index": 32268 - }, - "end": { - "line": 1216, - "column": 3, - "index": 32851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "headerColumn", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Name of the column which should be used to\ntitle each row object (optional)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getObject", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getObject", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getObject" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all table data and returns it as a multidimensional array." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 1218, - "column": 2, - "index": 32855 - }, - "end": { - "line": 1251, - "column": 3, - "index": 33622 - } - }, - "context": { - "loc": { - "start": { - "line": 1252, - "column": 2, - "index": 33625 - }, - "end": { - "line": 1258, - "column": 3, - "index": 33788 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getArray", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getArray" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - } - ], - "namespace": "p5.Table" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An internal class to store data that will be sent to a p5.RenderBuffer.\nThose need to eventually go into a Float32Array, so this class provides a\nvariable-length array container backed by a Float32Array so that it can be\nsent to the GPU without allocating a new array each frame." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Like a C++ vector, its fixed-length Float32Array backing its contents will\ndouble in size when it goes over its capacity." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 3, - "column": 0, - "index": 32 - }, - "end": { - "line": 27, - "column": 3, - "index": 926 - } - }, - "context": { - "loc": { - "start": { - "line": 28, - "column": 0, - "index": 927 - }, - "end": { - "line": 108, - "column": 2, - "index": 2998 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "DataArray", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a Float32Array window sized to the exact length of the data" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 35, - "column": 2, - "index": 1114 - }, - "end": { - "line": 37, - "column": 5, - "index": 1196 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 2, - "index": 1199 - }, - "end": { - "line": 40, - "column": 3, - "index": 1258 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dataArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "dataArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#dataArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A \"soft\" clear, which keeps the underlying storage size the same, but\nempties the contents of its dataArray()" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 42, - "column": 2, - "index": 1262 - }, - "end": { - "line": 45, - "column": 5, - "index": 1391 - } - }, - "context": { - "loc": { - "start": { - "line": 46, - "column": 2, - "index": 1394 - }, - "end": { - "line": 48, - "column": 3, - "index": 1428 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clear", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "clear", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#clear" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Can be used to scale a DataArray back down to fit its contents." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 50, - "column": 2, - "index": 1432 - }, - "end": { - "line": 52, - "column": 5, - "index": 1510 - } - }, - "context": { - "loc": { - "start": { - "line": 53, - "column": 2, - "index": 1513 - }, - "end": { - "line": 61, - "column": 3, - "index": 1839 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rescale", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "rescale", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#rescale" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A full reset, which allocates a new underlying Float32Array at its initial\nlength" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 63, - "column": 2, - "index": 1843 - }, - "end": { - "line": 66, - "column": 5, - "index": 1944 - } - }, - "context": { - "loc": { - "start": { - "line": 67, - "column": 2, - "index": 1947 - }, - "end": { - "line": 70, - "column": 3, - "index": 2032 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "reset", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "reset", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#reset" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Adds values to the DataArray, expanding its internal storage to\naccommodate the new items." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 72, - "column": 2, - "index": 2036 - }, - "end": { - "line": 75, - "column": 5, - "index": 2146 - } - }, - "context": { - "loc": { - "start": { - "line": 76, - "column": 2, - "index": 2149 - }, - "end": { - "line": 80, - "column": 3, - "index": 2296 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "values", - "lineNumber": 76, - "type": { - "type": "RestType" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "push", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "push", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#push" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a copy of the data from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to the index\n" - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 82, - "column": 2, - "index": 2300 - }, - "end": { - "line": 85, - "column": 5, - "index": 2409 - } - }, - "context": { - "loc": { - "start": { - "line": 86, - "column": 2, - "index": 2412 - }, - "end": { - "line": 88, - "column": 3, - "index": 2494 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 86 - }, - { - "title": "param", - "name": "to", - "lineNumber": 86 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "slice", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "slice", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#slice" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a mutable Float32Array window from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to\nthe index " - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 90, - "column": 2, - "index": 2498 - }, - "end": { - "line": 93, - "column": 5, - "index": 2618 - } - }, - "context": { - "loc": { - "start": { - "line": 94, - "column": 2, - "index": 2621 - }, - "end": { - "line": 96, - "column": 3, - "index": 2709 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 94 - }, - { - "title": "param", - "name": "to", - "lineNumber": 94 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "subArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "subArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#subArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Expand capacity of the internal storage until it can fit a target size" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 98, - "column": 2, - "index": 2713 - }, - "end": { - "line": 100, - "column": 5, - "index": 2798 - } - }, - "context": { - "loc": { - "start": { - "line": 101, - "column": 2, - "index": 2801 - }, - "end": { - "line": 107, - "column": 3, - "index": 2995 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "target", - "lineNumber": 101 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "ensureLength", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "ensureLength", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#ensureLength" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - } - ], - "namespace": "p5.DataArray" - } - ] - }, - "path": [ - { - "name": "p5" - } - ], - "namespace": "p5" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This is the p5 instance constructor." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "preload()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", and/or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " properties on it for running a sketch." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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" - } - ] - } - ] - }, - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 15, - "type": null, - "name": "p5" - }, - { - "title": "param", - "description": "a closure that can set optional preload(),\n setup(), and/or draw() properties on the\n given p5 instance", - "lineNumber": 16, - "type": { - "type": "FunctionType", - "params": [ - { - "type": "NameExpression", - "name": "p5" - } - ], - "result": null - }, - "name": "sketch" - }, - { - "title": "param", - "description": "element to attach canvas to", - "lineNumber": 19, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "HTMLElement" - } - }, - "name": "node" - }, - { - "title": "return", - "description": "a p5 instance", - "lineNumber": 20, - "type": { - "type": "NameExpression", - "name": "p5" - } - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 166 - }, - "end": { - "line": 31, - "column": 3, - "index": 1306 - } - }, - "context": { - "loc": { - "start": { - "line": 32, - "column": 0, - "index": 1307 - }, - "end": { - "line": 618, - "column": 1, - "index": 21073 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "sketch", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a closure that can set optional " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "preload()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", and/or " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " properties on the\ngiven p5 instance" - } - ] - } - ] - }, - "type": { - "type": "FunctionType", - "params": [ - { - "type": "NameExpression", - "name": "p5" - } - ], - "result": null - } - }, - { - "title": "param", - "name": "node", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "element to attach canvas to" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "HTMLElement" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a p5 instance" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "class", - "name": "p5", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the number of frames drawn since the sketch started." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "frameCount" - }, - { - "type": "text", - "value": "'s value is 0 inside " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". It\nincrements by 1 each time the code in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfinishes executing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "frameCount" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 69, - "column": 0, - "index": 1553 - }, - "end": { - "line": 116, - "column": 3, - "index": 2581 - } - }, - "context": { - "loc": { - "start": { - "line": 117, - "column": 0, - "index": 2582 - }, - "end": { - "line": 117, - "column": 28, - "index": 2610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "frameCount", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "frameCount", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "frameCount", - "scope": "instance" - } - ], - "namespace": "p5#frameCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the amount of time, in milliseconds, it took for\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to draw the previous frame. " - }, - { - "type": "inlineCode", - "value": "deltaTime" - }, - { - "type": "text", - "value": " is\nuseful for simulating physics." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "deltaTime" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 2612 - }, - "end": { - "line": 161, - "column": 3, - "index": 3539 - } - }, - "context": { - "loc": { - "start": { - "line": 162, - "column": 0, - "index": 3540 - }, - "end": { - "line": 162, - "column": 27, - "index": 3567 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deltaTime", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deltaTime", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deltaTime", - "scope": "instance" - } - ], - "namespace": "p5#deltaTime" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks whether the browser window is focused and can receive user input.\n" - }, - { - "type": "inlineCode", - "value": "focused" - }, - { - "type": "text", - "value": " is " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": " if the window if focused and " - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "focused" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 164, - "column": 0, - "index": 3569 - }, - "end": { - "line": 190, - "column": 3, - "index": 4257 - } - }, - "context": { - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 4258 - }, - "end": { - "line": 191, - "column": 43, - "index": 4301 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "focused", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "focused", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "focused", - "scope": "instance" - } - ], - "namespace": "p5#focused" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A string variable with the WebGL version in use. Its value equals one of\nthe followin string constants:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL2" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl2'" - }, - { - "type": "text", - "value": "," - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl'" - }, - { - "type": "text", - "value": ", or" - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "P2D" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'p2d'" - }, - { - "type": "text", - "value": ". This is the default for 2D sketches." - } - ] - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setAttributes()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for ways to set the\nWebGL version." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - }, - "name": "webglVersion" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 12 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 466, - "column": 0, - "index": 12055 - }, - "end": { - "line": 544, - "column": 3, - "index": 13784 - } - }, - "context": { - "loc": { - "start": { - "line": 545, - "column": 0, - "index": 13785 - }, - "end": { - "line": 545, - "column": 34, - "index": 13819 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "webglVersion", - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "webglVersion", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "webglVersion", - "scope": "instance" - } - ], - "namespace": "p5#webglVersion" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayWidth" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen width can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayWidth * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 547, - "column": 0, - "index": 13821 - }, - "end": { - "line": 574, - "column": 3, - "index": 14559 - } - }, - "context": { - "loc": { - "start": { - "line": 575, - "column": 0, - "index": 14560 - }, - "end": { - "line": 575, - "column": 41, - "index": 14601 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayWidth", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayWidth", - "scope": "instance" - } - ], - "namespace": "p5#displayWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayHeight" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen height can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayHeight * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 577, - "column": 0, - "index": 14603 - }, - "end": { - "line": 604, - "column": 3, - "index": 15346 - } - }, - "context": { - "loc": { - "start": { - "line": 605, - "column": 0, - "index": 15347 - }, - "end": { - "line": 605, - "column": 43, - "index": 15390 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayHeight", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayHeight", - "scope": "instance" - } - ], - "namespace": "p5#displayHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 607, - "column": 0, - "index": 15392 - }, - "end": { - "line": 631, - "column": 3, - "index": 16081 - } - }, - "context": { - "loc": { - "start": { - "line": 632, - "column": 0, - "index": 16082 - }, - "end": { - "line": 632, - "column": 44, - "index": 16126 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowWidth", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowWidth", - "scope": "instance" - } - ], - "namespace": "p5#windowWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 634, - "column": 0, - "index": 16128 - }, - "end": { - "line": 658, - "column": 3, - "index": 16819 - } - }, - "context": { - "loc": { - "start": { - "line": 659, - "column": 0, - "index": 16820 - }, - "end": { - "line": 659, - "column": 46, - "index": 16866 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowHeight", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowHeight", - "scope": "instance" - } - ], - "namespace": "p5#windowHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "width" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "width" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 750, - "column": 0, - "index": 19217 - }, - "end": { - "line": 816, - "column": 3, - "index": 20713 - } - }, - "context": { - "loc": { - "start": { - "line": 817, - "column": 0, - "index": 20714 - }, - "end": { - "line": 817, - "column": 23, - "index": 20737 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "width", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "width", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "width", - "scope": "instance" - } - ], - "namespace": "p5#width" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "height" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "height" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 819, - "column": 0, - "index": 20739 - }, - "end": { - "line": 885, - "column": 3, - "index": 22246 - } - }, - "context": { - "loc": { - "start": { - "line": 886, - "column": 0, - "index": 22247 - }, - "end": { - "line": 886, - "column": 24, - "index": 22271 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "height", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "height", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "height", - "scope": "instance" - } - ], - "namespace": "p5#height" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "nothing displayed", - "lineNumber": 20 - } - ], - "loc": { - "start": { - "line": 317, - "column": 4, - "index": 10982 - }, - "end": { - "line": 340, - "column": 7, - "index": 11811 - } - }, - "context": { - "loc": { - "start": { - "line": 341, - "column": 4, - "index": 11816 - }, - "end": { - "line": 402, - "column": 6, - "index": 13726 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "remove", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "remove", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#remove" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function does 3 things:" - } - ] - }, - { - "type": "list", - "ordered": true, - "start": 1, - "spread": true, - "children": [ - { - "type": "listItem", - "spread": true, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Bounds the desired start/stop angles for an arc (in radians) so that:" - } - ] - }, - { - "type": "code", - "lang": null, - "meta": null, - "value": "0 <= start < TWO_PI ; start <= stop < start + TWO_PI" - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This means that the arc rendering functions don't have to be concerned\nwith what happens if stop is smaller than start, or if the arc 'goes\nround more than once', etc.: they can just start at start and increase\nuntil stop and the correct arc will be drawn." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Optionally adjusts the angles within each quadrant to counter the naive\nscaling of the underlying ellipse up from the unit circle. Without\nthis, the angles become arbitrary when width != height: 45 degrees\nmight be drawn at 5 degrees on a 'wide' ellipse, or at 85 degrees on\na 'tall' ellipse." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Flags up when start and stop correspond to the same place on the\nunderlying ellipse. This is useful if you want to do something special\nthere (like rendering a whole ellipse instead)." - } - ] - } - ] - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 16, - "column": 0, - "index": 333 - }, - "end": { - "line": 37, - "column": 3, - "index": 1365 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 1366 - }, - "end": { - "line": 100, - "column": 2, - "index": 3623 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "start", - "lineNumber": 39 - }, - { - "title": "param", - "name": "stop", - "lineNumber": 40 - }, - { - "title": "param", - "name": "width", - "lineNumber": 41 - }, - { - "title": "param", - "name": "height", - "lineNumber": 42 - }, - { - "title": "param", - "name": "correctForScaling", - "lineNumber": 43 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_normalizeArcAngles", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_normalizeArcAngles", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_normalizeArcAngles" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for select and selectAll" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 6392 - }, - "end": { - "line": 193, - "column": 3, - "index": 6443 - } - }, - "context": { - "loc": { - "start": { - "line": 194, - "column": 0, - "index": 6444 - }, - "end": { - "line": 204, - "column": 2, - "index": 6751 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "p", - "lineNumber": 194 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_getContainer", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_getContainer", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_getContainer" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for getElement and getElements." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 206, - "column": 0, - "index": 6753 - }, - "end": { - "line": 208, - "column": 3, - "index": 6811 - } - }, - "context": { - "loc": { - "start": { - "line": 209, - "column": 0, - "index": 6812 - }, - "end": { - "line": 238, - "column": 2, - "index": 7767 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "elt", - "lineNumber": 209 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_wrapElement", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_wrapElement", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_wrapElement" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "INPUT *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 715, - "column": 0, - "index": 21883 - }, - "end": { - "line": 715, - "column": 13, - "index": 21896 - } - }, - "context": { - "loc": { - "start": { - "line": 827, - "column": 0, - "index": 24953 - }, - "end": { - "line": 840, - "column": 2, - "index": 25384 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "min", - "lineNumber": 827 - }, - { - "title": "param", - "name": "max", - "lineNumber": 827 - }, - { - "title": "param", - "name": "value", - "lineNumber": 827 - }, - { - "title": "param", - "name": "step", - "lineNumber": 827 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createSlider", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createSlider", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createSlider" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "AUDIO STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2041, - "column": 0, - "index": 61417 - }, - "end": { - "line": 2041, - "column": 19, - "index": 61436 - } - }, - "context": { - "loc": { - "start": { - "line": 2080, - "column": 0, - "index": 62975 - }, - "end": { - "line": 2083, - "column": 2, - "index": 63135 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "src", - "lineNumber": 2080 - }, - { - "title": "param", - "name": "callback", - "lineNumber": 2080 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createAudio", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createAudio", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createAudio" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "CAMERA STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2085, - "column": 0, - "index": 63137 - }, - "end": { - "line": 2085, - "column": 20, - "index": 63157 - } - }, - "context": { - "loc": { - "start": { - "line": 2087, - "column": 0, - "index": 63159 - }, - "end": { - "line": 2087, - "column": 29, - "index": 63188 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "VIDEO", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "VIDEO", - "scope": "instance" - } - ], - "namespace": "p5#VIDEO" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - }, - "name": "deviceOrientation" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 20, - "column": 3, - "index": 511 - } - }, - "context": { - "loc": { - "start": { - "line": 21, - "column": 0, - "index": 512 - }, - "end": { - "line": 22, - "column": 74, - "index": 619 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deviceOrientation", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deviceOrientation", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deviceOrientation", - "scope": "instance" - } - ], - "namespace": "p5#deviceOrientation" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationX always contains the acceleration of the\ndevice along the x axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 24, - "column": 0, - "index": 621 - }, - "end": { - "line": 43, - "column": 3, - "index": 1167 - } - }, - "context": { - "loc": { - "start": { - "line": 44, - "column": 0, - "index": 1168 - }, - "end": { - "line": 44, - "column": 31, - "index": 1199 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationX", - "scope": "instance" - } - ], - "namespace": "p5#accelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationY always contains the acceleration of the\ndevice along the y axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 46, - "column": 0, - "index": 1201 - }, - "end": { - "line": 65, - "column": 3, - "index": 1746 - } - }, - "context": { - "loc": { - "start": { - "line": 66, - "column": 0, - "index": 1747 - }, - "end": { - "line": 66, - "column": 31, - "index": 1778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationY", - "scope": "instance" - } - ], - "namespace": "p5#accelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationZ always contains the acceleration of the\ndevice along the z axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 68, - "column": 0, - "index": 1780 - }, - "end": { - "line": 88, - "column": 3, - "index": 2328 - } - }, - "context": { - "loc": { - "start": { - "line": 89, - "column": 0, - "index": 2329 - }, - "end": { - "line": 89, - "column": 31, - "index": 2360 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationZ", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#accelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 91, - "column": 0, - "index": 2362 - }, - "end": { - "line": 98, - "column": 3, - "index": 2625 - } - }, - "context": { - "loc": { - "start": { - "line": 99, - "column": 0, - "index": 2626 - }, - "end": { - "line": 99, - "column": 32, - "index": 2658 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationX", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationX", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 101, - "column": 0, - "index": 2660 - }, - "end": { - "line": 108, - "column": 3, - "index": 2923 - } - }, - "context": { - "loc": { - "start": { - "line": 109, - "column": 0, - "index": 2924 - }, - "end": { - "line": 109, - "column": 32, - "index": 2956 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationY", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationY", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 111, - "column": 0, - "index": 2958 - }, - "end": { - "line": 118, - "column": 3, - "index": 3221 - } - }, - "context": { - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 3222 - }, - "end": { - "line": 119, - "column": 32, - "index": 3254 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationZ", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationX always contains the rotation of the\ndevice along the x axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES, the value will be -180 to 180. If\nit is set to RADIANS, the value will be -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 132, - "column": 0, - "index": 3568 - }, - "end": { - "line": 162, - "column": 3, - "index": 4447 - } - }, - "context": { - "loc": { - "start": { - "line": 163, - "column": 0, - "index": 4448 - }, - "end": { - "line": 163, - "column": 27, - "index": 4475 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationX", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationX", - "scope": "instance" - } - ], - "namespace": "p5#rotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationY always contains the rotation of the\ndevice along the y axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 165, - "column": 0, - "index": 4477 - }, - "end": { - "line": 195, - "column": 3, - "index": 5358 - } - }, - "context": { - "loc": { - "start": { - "line": 196, - "column": 0, - "index": 5359 - }, - "end": { - "line": 196, - "column": 27, - "index": 5386 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationY", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationY", - "scope": "instance" - } - ], - "namespace": "p5#rotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationZ always contains the rotation of the\ndevice along the z axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Unlike rotationX and rotationY, this variable is available for devices\nwith a built-in compass only." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - }, - { - "title": "property", - "description": null, - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 33 - } - ], - "loc": { - "start": { - "line": 198, - "column": 0, - "index": 5388 - }, - "end": { - "line": 232, - "column": 3, - "index": 6377 - } - }, - "context": { - "loc": { - "start": { - "line": 233, - "column": 0, - "index": 6378 - }, - "end": { - "line": 233, - "column": 27, - "index": 6405 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationZ", - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationZ", - "scope": "instance" - } - ], - "namespace": "p5#rotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES,\nthe value will be -180 to 180. If it is set to RADIANS, the value will\nbe -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationX can also be used with rotationX to determine the rotate\ndirection of the device along the X-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 40 - } - ], - "loc": { - "start": { - "line": 235, - "column": 0, - "index": 6407 - }, - "end": { - "line": 276, - "column": 3, - "index": 7745 - } - }, - "context": { - "loc": { - "start": { - "line": 277, - "column": 0, - "index": 7746 - }, - "end": { - "line": 277, - "column": 28, - "index": 7774 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationX", - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationX", - "scope": "instance" - } - ], - "namespace": "p5#pRotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationY can also be used with rotationY to determine the rotate\ndirection of the device along the Y-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 39 - } - ], - "loc": { - "start": { - "line": 279, - "column": 0, - "index": 7776 - }, - "end": { - "line": 319, - "column": 3, - "index": 9113 - } - }, - "context": { - "loc": { - "start": { - "line": 320, - "column": 0, - "index": 9114 - }, - "end": { - "line": 320, - "column": 28, - "index": 9142 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationY", - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationY", - "scope": "instance" - } - ], - "namespace": "p5#pRotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationZ can also be used with rotationZ to determine the rotate\ndirection of the device along the Z-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 35 - } - ], - "loc": { - "start": { - "line": 322, - "column": 0, - "index": 9144 - }, - "end": { - "line": 358, - "column": 3, - "index": 10350 - } - }, - "context": { - "loc": { - "start": { - "line": 359, - "column": 0, - "index": 10351 - }, - "end": { - "line": 359, - "column": 28, - "index": 10379 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationZ", - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationZ", - "scope": "instance" - } - ], - "namespace": "p5#pRotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When a device is rotated, the axis that triggers the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "deviceTurned()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nmethod is stored in the turnAxis variable. The turnAxis variable is only defined within\nthe scope of deviceTurned()." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "turnAxis" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 379, - "column": 0, - "index": 10890 - }, - "end": { - "line": 412, - "column": 3, - "index": 11826 - } - }, - "context": { - "loc": { - "start": { - "line": 413, - "column": 0, - "index": 11827 - }, - "end": { - "line": 413, - "column": 34, - "index": 11861 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "turnAxis", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "turnAxis", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "turnAxis", - "scope": "instance" - } - ], - "namespace": "p5#turnAxis" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyIsPressed" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is true if any key is pressed\nand false if no keys are pressed." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "keyIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 111 - }, - "end": { - "line": 30, - "column": 3, - "index": 575 - } - }, - "context": { - "loc": { - "start": { - "line": 31, - "column": 0, - "index": 576 - }, - "end": { - "line": 31, - "column": 34, - "index": 610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "isKeyPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "isKeyPressed", - "scope": "instance" - } - ], - "namespace": "p5#isKeyPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyTyped()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". For non-ASCII keys, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyCode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nvariable." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "key" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 34, - "column": 0, - "index": 655 - }, - "end": { - "line": 57, - "column": 3, - "index": 1373 - } - }, - "context": { - "loc": { - "start": { - "line": 58, - "column": 0, - "index": 1374 - }, - "end": { - "line": 58, - "column": 22, - "index": 1396 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "key", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "key", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "key", - "scope": "instance" - } - ], - "namespace": "p5#key" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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: " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keycode.info" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "keyCode" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 60, - "column": 0, - "index": 1398 - }, - "end": { - "line": 95, - "column": 3, - "index": 2425 - } - }, - "context": { - "loc": { - "start": { - "line": 96, - "column": 0, - "index": 2426 - }, - "end": { - "line": 96, - "column": 25, - "index": 2451 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyCode", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "keyCode", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "keyCode", - "scope": "instance" - } - ], - "namespace": "p5#keyCode" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The onblur function is called when the user is no longer focused\non the p5 element. Because the keyup events will not fire if the user is\nnot focused on the element we must assume all keys currently down have\nbeen released." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 291, - "column": 0, - "index": 8735 - }, - "end": { - "line": 296, - "column": 3, - "index": 8978 - } - }, - "context": { - "loc": { - "start": { - "line": 297, - "column": 0, - "index": 8979 - }, - "end": { - "line": 299, - "column": 2, - "index": 9041 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "e", - "lineNumber": 297 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_onblur", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_onblur", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_onblur" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedX contains the horizontal movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 4 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 40, - "column": 3, - "index": 777 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 778 - }, - "end": { - "line": 41, - "column": 24, - "index": 802 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedX", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedX", - "scope": "instance" - } - ], - "namespace": "p5#movedX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedY contains the vertical movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 43, - "column": 0, - "index": 804 - }, - "end": { - "line": 70, - "column": 3, - "index": 1394 - } - }, - "context": { - "loc": { - "start": { - "line": 71, - "column": 0, - "index": 1395 - }, - "end": { - "line": 71, - "column": 24, - "index": 1419 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedY", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedY", - "scope": "instance" - } - ], - "namespace": "p5#movedY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 80, - "column": 0, - "index": 1666 - }, - "end": { - "line": 101, - "column": 3, - "index": 2316 - } - }, - "context": { - "loc": { - "start": { - "line": 102, - "column": 0, - "index": 2317 - }, - "end": { - "line": 102, - "column": 24, - "index": 2341 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseX", - "scope": "instance" - } - ], - "namespace": "p5#mouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 2343 - }, - "end": { - "line": 125, - "column": 3, - "index": 2986 - } - }, - "context": { - "loc": { - "start": { - "line": 126, - "column": 0, - "index": 2987 - }, - "end": { - "line": 126, - "column": 24, - "index": 3011 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseY", - "scope": "instance" - } - ], - "namespace": "p5#mouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 128, - "column": 0, - "index": 3013 - }, - "end": { - "line": 156, - "column": 3, - "index": 3890 - } - }, - "context": { - "loc": { - "start": { - "line": 157, - "column": 0, - "index": 3891 - }, - "end": { - "line": 157, - "column": 25, - "index": 3916 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseX", - "scope": "instance" - } - ], - "namespace": "p5#pmouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 159, - "column": 0, - "index": 3918 - }, - "end": { - "line": 186, - "column": 3, - "index": 4745 - } - }, - "context": { - "loc": { - "start": { - "line": 187, - "column": 0, - "index": 4746 - }, - "end": { - "line": 187, - "column": 25, - "index": 4771 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseY", - "scope": "instance" - } - ], - "namespace": "p5#pmouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseX always contains the current horizontal\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 189, - "column": 0, - "index": 4773 - }, - "end": { - "line": 223, - "column": 3, - "index": 5653 - } - }, - "context": { - "loc": { - "start": { - "line": 224, - "column": 0, - "index": 5654 - }, - "end": { - "line": 224, - "column": 27, - "index": 5681 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseX", - "scope": "instance" - } - ], - "namespace": "p5#winMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseY always contains the current vertical\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 226, - "column": 0, - "index": 5683 - }, - "end": { - "line": 260, - "column": 3, - "index": 6560 - } - }, - "context": { - "loc": { - "start": { - "line": 261, - "column": 0, - "index": 6561 - }, - "end": { - "line": 261, - "column": 27, - "index": 6588 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseY", - "scope": "instance" - } - ], - "namespace": "p5#winMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 263, - "column": 0, - "index": 6590 - }, - "end": { - "line": 299, - "column": 3, - "index": 7675 - } - }, - "context": { - "loc": { - "start": { - "line": 300, - "column": 0, - "index": 7676 - }, - "end": { - "line": 300, - "column": 28, - "index": 7704 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseX", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseX", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 302, - "column": 0, - "index": 7706 - }, - "end": { - "line": 338, - "column": 3, - "index": 8785 - } - }, - "context": { - "loc": { - "start": { - "line": 339, - "column": 0, - "index": 8786 - }, - "end": { - "line": 339, - "column": 28, - "index": 8814 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseY", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseY", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - }, - "name": "mouseButton" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 341, - "column": 0, - "index": 8816 - }, - "end": { - "line": 375, - "column": 3, - "index": 9715 - } - }, - "context": { - "loc": { - "start": { - "line": 376, - "column": 0, - "index": 9716 - }, - "end": { - "line": 376, - "column": 29, - "index": 9745 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseButton", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseButton", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseButton", - "scope": "instance" - } - ], - "namespace": "p5#mouseButton" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable mouseIsPressed is true if the mouse is pressed\nand false if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "mouseIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 378, - "column": 0, - "index": 9747 - }, - "end": { - "line": 404, - "column": 3, - "index": 10289 - } - }, - "context": { - "loc": { - "start": { - "line": 405, - "column": 0, - "index": 10290 - }, - "end": { - "line": 405, - "column": 36, - "index": 10326 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseIsPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseIsPressed", - "scope": "instance" - } - ], - "namespace": "p5#mouseIsPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The touches[] array is not supported on Safari and IE on touch-based\ndesktops (laptops)." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - }, - "name": "touches" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 108 - }, - "end": { - "line": 37, - "column": 3, - "index": 883 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 884 - }, - "end": { - "line": 38, - "column": 26, - "index": 910 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/touch.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "touches", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "touches", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "touches", - "scope": "instance" - } - ], - "namespace": "p5#touches" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An array containing the color of each pixel on the canvas. Colors are\nstored as numbers representing red, green, blue, and alpha (RGBA) values.\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " is a one-dimensional array for performance reasons." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Each pixel occupies four elements in the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array, one for each RGBA\nvalue. For example, the pixel at coordinates (0, 0) stores its RGBA values\nat " - }, - { - "type": "inlineCode", - "value": "pixels[0]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[1]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[2]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[3]" - }, - { - "type": "text", - "value": ", respectively.\nThe next pixel at coordinates (1, 0) stores its RGBA values at " - }, - { - "type": "inlineCode", - "value": "pixels[4]" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "inlineCode", - "value": "pixels[5]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[6]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[7]" - }, - { - "type": "text", - "value": ". And so on. The " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array\nfor a 100×100 canvas has 100 × 100 × 4 = 40,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Some displays use several smaller pixels to set the color at a single\npoint. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function returns\nthe pixel density of the canvas. High density displays often have a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " of 2. On such a display, the\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array for a 100×100 canvas has 200 × 200 × 4 =\n160,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Accessing the RGBA values for a point on the canvas requires a little math\nas shown below. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadPixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function\nmust be called before accessing the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array. The\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "updatePixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function must be called\nafter any changes are made." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "pixels" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 169 - }, - "end": { - "line": 103, - "column": 3, - "index": 3031 - } - }, - "context": { - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 3032 - }, - "end": { - "line": 104, - "column": 25, - "index": 3057 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pixels", - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pixels", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pixels", - "scope": "instance" - } - ], - "namespace": "p5#pixels" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function to measure ascent and descent." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 362, - "column": 0, - "index": 9474 - }, - "end": { - "line": 364, - "column": 3, - "index": 9531 - } - }, - "context": { - "loc": { - "start": { - "line": 365, - "column": 0, - "index": 9532 - }, - "end": { - "line": 367, - "column": 2, - "index": 9627 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_updateTextMetrics", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_updateTextMetrics", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_updateTextMetrics" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ensures that p5 is using a 3d renderer. throws an error if not." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2350, - "column": 0, - "index": 73393 - }, - "end": { - "line": 2352, - "column": 3, - "index": 73467 - } - }, - "context": { - "loc": { - "start": { - "line": 2353, - "column": 0, - "index": 73468 - }, - "end": { - "line": 2358, - "column": 2, - "index": 73742 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "name", - "lineNumber": 2353 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_assert3d", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_assert3d", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_assert3d" - } - ], - "events": [], - "static": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Turn off some features of the friendly error system (FES), which can give\na significant boost to performance when needed." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ndisabling the friendly error system" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "disableFriendlyErrors" - }, - { - "title": "example", - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 754, - "column": 0, - "index": 26038 - }, - "end": { - "line": 776, - "column": 3, - "index": 26889 - } - }, - "context": { - "loc": { - "start": { - "line": 777, - "column": 0, - "index": 26890 - }, - "end": { - "line": 777, - "column": 33, - "index": 26923 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "disableFriendlyErrors", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "disableFriendlyErrors", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "disableFriendlyErrors", - "scope": "static" - } - ], - "namespace": "p5.disableFriendlyErrors" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Path to the media element's source as a string." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.MediaElement", - "lineNumber": 3 - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "src" - }, - { - "title": "return", - "description": "src", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 4842, - "column": 0, - "index": 139686 - }, - "end": { - "line": 4868, - "column": 3, - "index": 140231 - } - }, - "context": { - "loc": { - "start": { - "line": 4958, - "column": 0, - "index": 142394 - }, - "end": { - "line": 5009, - "column": 2, - "index": 143967 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "src" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "File", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "File", - "scope": "static" - } - ], - "namespace": "p5.File" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Table Options\nGeneric class for handling tabular data, typically from a\nCSV, TSV, or other sort of spreadsheet file.\nCSV files are\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ncomma separated values" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", often with the data in quotes. TSV\nfiles use tabs as separators, and usually don't bother with the\nquotes.\nFile names should end with .csv if they're comma separated.\nA rough \"spec\" for CSV can be found\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "here" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nTo load files, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method.\nTo save tables to your computer, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "save" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method\nor the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "saveTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Possible options include:" - } - ] - }, - { - "type": "html", - "value": "
    \n
  • csv - parse the table as comma-separated values\n
  • tsv - parse the table as tab-separated values\n
  • header - this table has a header (title) row\n
" - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 93 - }, - "end": { - "line": 31, - "column": 3, - "index": 1053 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 1379 - }, - "end": { - "line": 1259, - "column": 2, - "index": 33791 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "Table", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addRow()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new row of data to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "set()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object is included as a parameter, then that row is\nduplicated and added to the table." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row to be added to the table", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - "name": "row" - }, - { - "title": "return", - "description": "the row that was added", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 47, - "column": 2, - "index": 1476 - }, - "end": { - "line": 94, - "column": 3, - "index": 2995 - } - }, - "context": { - "loc": { - "start": { - "line": 95, - "column": 2, - "index": 2998 - }, - "end": { - "line": 106, - "column": 3, - "index": 3319 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row to be added to the table" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the row that was added" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes a row from the table object." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to remove", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "id" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 108, - "column": 2, - "index": 3323 - }, - "end": { - "line": 145, - "column": 3, - "index": 4202 - } - }, - "context": { - "loc": { - "start": { - "line": 146, - "column": 2, - "index": 4205 - }, - "end": { - "line": 151, - "column": 3, - "index": 4410 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "id", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to remove" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a reference to the specified " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". The reference\ncan then be used to get and set values of the selected row." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to get", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "rowID" - }, - { - "title": "return", - "description": "p5.TableRow object", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 153, - "column": 2, - "index": 4414 - }, - "end": { - "line": 191, - "column": 3, - "index": 5463 - } - }, - "context": { - "loc": { - "start": { - "line": 192, - "column": 2, - "index": 5466 - }, - "end": { - "line": 194, - "column": 3, - "index": 5507 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "r", - "lineNumber": 192 - }, - { - "title": "param", - "name": "rowID", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to get" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Gets all rows from the table. Returns an array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Array of p5.TableRows", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 196, - "column": 2, - "index": 5511 - }, - "end": { - "line": 237, - "column": 3, - "index": 6588 - } - }, - "context": { - "loc": { - "start": { - "line": 238, - "column": 2, - "index": 6591 - }, - "end": { - "line": 240, - "column": 3, - "index": 6629 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 242, - "column": 2, - "index": 6633 - }, - "end": { - "line": 282, - "column": 3, - "index": 7805 - } - }, - "context": { - "loc": { - "start": { - "line": 283, - "column": 2, - "index": 7808 - }, - "end": { - "line": 301, - "column": 3, - "index": 8272 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 10, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 303, - "column": 2, - "index": 8276 - }, - "end": { - "line": 348, - "column": 3, - "index": 9683 - } - }, - "context": { - "loc": { - "start": { - "line": 349, - "column": 2, - "index": 9686 - }, - "end": { - "line": 366, - "column": 3, - "index": 10136 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "TableRow object", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 368, - "column": 2, - "index": 10140 - }, - "end": { - "line": 407, - "column": 3, - "index": 11362 - } - }, - "context": { - "loc": { - "start": { - "line": 408, - "column": 2, - "index": 11365 - }, - "end": { - "line": 423, - "column": 3, - "index": 11778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "TableRow object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 425, - "column": 2, - "index": 11782 - }, - "end": { - "line": 472, - "column": 3, - "index": 13226 - } - }, - "context": { - "loc": { - "start": { - "line": 473, - "column": 2, - "index": 13229 - }, - "end": { - "line": 489, - "column": 3, - "index": 13668 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all values in the specified column, and returns them\nas an array. The column may be specified by either its ID or title." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String or Number of the column to return", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "Array of column values", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 491, - "column": 2, - "index": 13672 - }, - "end": { - "line": 525, - "column": 3, - "index": 14658 - } - }, - "context": { - "loc": { - "start": { - "line": 526, - "column": 2, - "index": 14661 - }, - "end": { - "line": 538, - "column": 3, - "index": 14980 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 526 - }, - { - "title": "param", - "name": "column", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String or Number of the column to return" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of column values" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes all rows from a Table. While all rows are removed,\ncolumns and column titles are maintained." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 540, - "column": 2, - "index": 14984 - }, - "end": { - "line": 571, - "column": 3, - "index": 15789 - } - }, - "context": { - "loc": { - "start": { - "line": 572, - "column": 2, - "index": 15792 - }, - "end": { - "line": 575, - "column": 3, - "index": 15852 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clearRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "clearRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#clearRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new column to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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.)" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "title of the given column", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "title" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 577, - "column": 2, - "index": 15856 - }, - "end": { - "line": 619, - "column": 3, - "index": 17079 - } - }, - "context": { - "loc": { - "start": { - "line": 620, - "column": 2, - "index": 17082 - }, - "end": { - "line": 623, - "column": 3, - "index": 17160 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "title", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "title of the given column" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of columns in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of columns in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 625, - "column": 2, - "index": 17164 - }, - "end": { - "line": 655, - "column": 3, - "index": 17854 - } - }, - "context": { - "loc": { - "start": { - "line": 656, - "column": 2, - "index": 17857 - }, - "end": { - "line": 658, - "column": 3, - "index": 17912 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of columns in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumnCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumnCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumnCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of rows in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of rows in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 660, - "column": 2, - "index": 17916 - }, - "end": { - "line": 690, - "column": 3, - "index": 18564 - } - }, - "context": { - "loc": { - "start": { - "line": 691, - "column": 2, - "index": 18567 - }, - "end": { - "line": 693, - "column": 3, - "index": 18616 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of rows in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRowCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRowCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRowCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes any of the specified characters (or \"tokens\")." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String listing characters to be removed", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "chars" - }, - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 695, - "column": 2, - "index": 18620 - }, - "end": { - "line": 730, - "column": 3, - "index": 19601 - } - }, - "context": { - "loc": { - "start": { - "line": 731, - "column": 2, - "index": 19604 - }, - "end": { - "line": 764, - "column": 3, - "index": 20779 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "chars", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String listing characters to be removed" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeTokens", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeTokens", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeTokens" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 766, - "column": 2, - "index": 20783 - }, - "end": { - "line": 798, - "column": 3, - "index": 21711 - } - }, - "context": { - "loc": { - "start": { - "line": 799, - "column": 2, - "index": 21714 - }, - "end": { - "line": 827, - "column": 3, - "index": 22666 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "trim", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "trim", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#trim" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "removeColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "columnName (string) or ID (number)", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 829, - "column": 2, - "index": 22670 - }, - "end": { - "line": 864, - "column": 3, - "index": 23691 - } - }, - "context": { - "loc": { - "start": { - "line": 865, - "column": 2, - "index": 23694 - }, - "end": { - "line": 888, - "column": 3, - "index": 24362 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "c", - "lineNumber": 865 - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or ID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 890, - "column": 2, - "index": 24366 - }, - "end": { - "line": 932, - "column": 3, - "index": 25518 - } - }, - "context": { - "loc": { - "start": { - "line": 933, - "column": 2, - "index": 25521 - }, - "end": { - "line": 935, - "column": 3, - "index": 25590 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "set", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "set", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#set" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 937, - "column": 2, - "index": 25594 - }, - "end": { - "line": 976, - "column": 3, - "index": 26578 - } - }, - "context": { - "loc": { - "start": { - "line": 977, - "column": 2, - "index": 26581 - }, - "end": { - "line": 979, - "column": 3, - "index": 26656 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 981, - "column": 2, - "index": 26660 - }, - "end": { - "line": 1019, - "column": 3, - "index": 27767 - } - }, - "context": { - "loc": { - "start": { - "line": 1020, - "column": 2, - "index": 27770 - }, - "end": { - "line": 1022, - "column": 3, - "index": 27851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1024, - "column": 2, - "index": 27855 - }, - "end": { - "line": 1062, - "column": 3, - "index": 28842 - } - }, - "context": { - "loc": { - "start": { - "line": 1063, - "column": 2, - "index": 28845 - }, - "end": { - "line": 1065, - "column": 3, - "index": 28907 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "get", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "get", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#get" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1067, - "column": 2, - "index": 28911 - }, - "end": { - "line": 1103, - "column": 3, - "index": 29853 - } - }, - "context": { - "loc": { - "start": { - "line": 1104, - "column": 2, - "index": 29856 - }, - "end": { - "line": 1106, - "column": 3, - "index": 29924 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1108, - "column": 2, - "index": 29928 - }, - "end": { - "line": 1151, - "column": 3, - "index": 31214 - } - }, - "context": { - "loc": { - "start": { - "line": 1153, - "column": 2, - "index": 31218 - }, - "end": { - "line": 1155, - "column": 3, - "index": 31292 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Name of the column which should be used to\n title each row object (optional)", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "headerColumn" - }, - { - "title": "return", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 1157, - "column": 2, - "index": 31296 - }, - "end": { - "line": 1195, - "column": 3, - "index": 32265 - } - }, - "context": { - "loc": { - "start": { - "line": 1196, - "column": 2, - "index": 32268 - }, - "end": { - "line": 1216, - "column": 3, - "index": 32851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "headerColumn", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Name of the column which should be used to\ntitle each row object (optional)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getObject", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getObject", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getObject" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all table data and returns it as a multidimensional array." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 1218, - "column": 2, - "index": 32855 - }, - "end": { - "line": 1251, - "column": 3, - "index": 33622 - } - }, - "context": { - "loc": { - "start": { - "line": 1252, - "column": 2, - "index": 33625 - }, - "end": { - "line": 1258, - "column": 3, - "index": 33788 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getArray", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getArray" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - } - ], - "namespace": "p5.Table" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An internal class to store data that will be sent to a p5.RenderBuffer.\nThose need to eventually go into a Float32Array, so this class provides a\nvariable-length array container backed by a Float32Array so that it can be\nsent to the GPU without allocating a new array each frame." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Like a C++ vector, its fixed-length Float32Array backing its contents will\ndouble in size when it goes over its capacity." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 3, - "column": 0, - "index": 32 - }, - "end": { - "line": 27, - "column": 3, - "index": 926 - } - }, - "context": { - "loc": { - "start": { - "line": 28, - "column": 0, - "index": 927 - }, - "end": { - "line": 108, - "column": 2, - "index": 2998 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "DataArray", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a Float32Array window sized to the exact length of the data" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 35, - "column": 2, - "index": 1114 - }, - "end": { - "line": 37, - "column": 5, - "index": 1196 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 2, - "index": 1199 - }, - "end": { - "line": 40, - "column": 3, - "index": 1258 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dataArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "dataArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#dataArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A \"soft\" clear, which keeps the underlying storage size the same, but\nempties the contents of its dataArray()" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 42, - "column": 2, - "index": 1262 - }, - "end": { - "line": 45, - "column": 5, - "index": 1391 - } - }, - "context": { - "loc": { - "start": { - "line": 46, - "column": 2, - "index": 1394 - }, - "end": { - "line": 48, - "column": 3, - "index": 1428 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clear", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "clear", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#clear" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Can be used to scale a DataArray back down to fit its contents." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 50, - "column": 2, - "index": 1432 - }, - "end": { - "line": 52, - "column": 5, - "index": 1510 - } - }, - "context": { - "loc": { - "start": { - "line": 53, - "column": 2, - "index": 1513 - }, - "end": { - "line": 61, - "column": 3, - "index": 1839 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rescale", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "rescale", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#rescale" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A full reset, which allocates a new underlying Float32Array at its initial\nlength" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 63, - "column": 2, - "index": 1843 - }, - "end": { - "line": 66, - "column": 5, - "index": 1944 - } - }, - "context": { - "loc": { - "start": { - "line": 67, - "column": 2, - "index": 1947 - }, - "end": { - "line": 70, - "column": 3, - "index": 2032 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "reset", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "reset", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#reset" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Adds values to the DataArray, expanding its internal storage to\naccommodate the new items." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 72, - "column": 2, - "index": 2036 - }, - "end": { - "line": 75, - "column": 5, - "index": 2146 - } - }, - "context": { - "loc": { - "start": { - "line": 76, - "column": 2, - "index": 2149 - }, - "end": { - "line": 80, - "column": 3, - "index": 2296 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "values", - "lineNumber": 76, - "type": { - "type": "RestType" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "push", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "push", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#push" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a copy of the data from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to the index\n" - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 82, - "column": 2, - "index": 2300 - }, - "end": { - "line": 85, - "column": 5, - "index": 2409 - } - }, - "context": { - "loc": { - "start": { - "line": 86, - "column": 2, - "index": 2412 - }, - "end": { - "line": 88, - "column": 3, - "index": 2494 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 86 - }, - { - "title": "param", - "name": "to", - "lineNumber": 86 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "slice", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "slice", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#slice" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a mutable Float32Array window from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to\nthe index " - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 90, - "column": 2, - "index": 2498 - }, - "end": { - "line": 93, - "column": 5, - "index": 2618 - } - }, - "context": { - "loc": { - "start": { - "line": 94, - "column": 2, - "index": 2621 - }, - "end": { - "line": 96, - "column": 3, - "index": 2709 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 94 - }, - { - "title": "param", - "name": "to", - "lineNumber": 94 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "subArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "subArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#subArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Expand capacity of the internal storage until it can fit a target size" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 98, - "column": 2, - "index": 2713 - }, - "end": { - "line": 100, - "column": 5, - "index": 2798 - } - }, - "context": { - "loc": { - "start": { - "line": 101, - "column": 2, - "index": 2801 - }, - "end": { - "line": 107, - "column": 3, - "index": 2995 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "target", - "lineNumber": 101 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "ensureLength", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "ensureLength", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#ensureLength" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - } - ], - "namespace": "p5.DataArray" - } - ] - }, - "path": [ - { - "name": "p5", - "kind": "class" - } - ], - "namespace": "p5" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "inlineCode", - "value": "p5()" - }, - { - "type": "text", - "value": " 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" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nDan Shiffman's Coding Train video tutorial" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or this\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "tutorial page" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfor more info." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "By default, all p5.js functions are in the global namespace (i.e. bound to the window\nobject), meaning you can call them simply " - }, - { - "type": "inlineCode", - "value": "ellipse()" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "fill()" - }, - { - "type": "text", - "value": ", 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 24, - "name": "p5" - }, - { - "title": "param", - "description": "a function containing a p5.js sketch", - "lineNumber": 25, - "type": { - "type": "NameExpression", - "name": "Object" - }, - "name": "sketch" - }, - { - "title": "param", - "description": "ID or pointer to HTML DOM node to contain sketch in", - "lineNumber": 26, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Object" - } - ] - }, - "name": "node" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 27 - }, - { - "title": "alt", - "description": "white rectangle on black background", - "lineNumber": 47 - } - ], - "loc": { - "start": { - "line": 494, - "column": 0, - "index": 14829 - }, - "end": { - "line": 543, - "column": 3, - "index": 16860 - } - }, - "context": { - "loc": { - "start": { - "line": 544, - "column": 0, - "index": 16861 - }, - "end": { - "line": 544, - "column": 18, - "index": 16879 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/structure.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "sketch", - "lineNumber": 25, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a function containing a p5.js sketch" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "param", - "name": "node", - "lineNumber": 26, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID or pointer to HTML DOM node to contain sketch in" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Object" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "p5", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the number of frames drawn since the sketch started." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "frameCount" - }, - { - "type": "text", - "value": "'s value is 0 inside " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". It\nincrements by 1 each time the code in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfinishes executing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "frameCount" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 69, - "column": 0, - "index": 1553 - }, - "end": { - "line": 116, - "column": 3, - "index": 2581 - } - }, - "context": { - "loc": { - "start": { - "line": 117, - "column": 0, - "index": 2582 - }, - "end": { - "line": 117, - "column": 28, - "index": 2610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "frameCount", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "frameCount", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "frameCount", - "scope": "instance" - } - ], - "namespace": "p5#frameCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the amount of time, in milliseconds, it took for\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to draw the previous frame. " - }, - { - "type": "inlineCode", - "value": "deltaTime" - }, - { - "type": "text", - "value": " is\nuseful for simulating physics." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "deltaTime" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 2612 - }, - "end": { - "line": 161, - "column": 3, - "index": 3539 - } - }, - "context": { - "loc": { - "start": { - "line": 162, - "column": 0, - "index": 3540 - }, - "end": { - "line": 162, - "column": 27, - "index": 3567 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deltaTime", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deltaTime", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deltaTime", - "scope": "instance" - } - ], - "namespace": "p5#deltaTime" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks whether the browser window is focused and can receive user input.\n" - }, - { - "type": "inlineCode", - "value": "focused" - }, - { - "type": "text", - "value": " is " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": " if the window if focused and " - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "focused" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 164, - "column": 0, - "index": 3569 - }, - "end": { - "line": 190, - "column": 3, - "index": 4257 - } - }, - "context": { - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 4258 - }, - "end": { - "line": 191, - "column": 43, - "index": 4301 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "focused", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "focused", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "focused", - "scope": "instance" - } - ], - "namespace": "p5#focused" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A string variable with the WebGL version in use. Its value equals one of\nthe followin string constants:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL2" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl2'" - }, - { - "type": "text", - "value": "," - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl'" - }, - { - "type": "text", - "value": ", or" - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "P2D" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'p2d'" - }, - { - "type": "text", - "value": ". This is the default for 2D sketches." - } - ] - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setAttributes()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for ways to set the\nWebGL version." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - }, - "name": "webglVersion" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 12 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 466, - "column": 0, - "index": 12055 - }, - "end": { - "line": 544, - "column": 3, - "index": 13784 - } - }, - "context": { - "loc": { - "start": { - "line": 545, - "column": 0, - "index": 13785 - }, - "end": { - "line": 545, - "column": 34, - "index": 13819 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "webglVersion", - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "webglVersion", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "webglVersion", - "scope": "instance" - } - ], - "namespace": "p5#webglVersion" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayWidth" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen width can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayWidth * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 547, - "column": 0, - "index": 13821 - }, - "end": { - "line": 574, - "column": 3, - "index": 14559 - } - }, - "context": { - "loc": { - "start": { - "line": 575, - "column": 0, - "index": 14560 - }, - "end": { - "line": 575, - "column": 41, - "index": 14601 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayWidth", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayWidth", - "scope": "instance" - } - ], - "namespace": "p5#displayWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayHeight" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen height can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayHeight * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 577, - "column": 0, - "index": 14603 - }, - "end": { - "line": 604, - "column": 3, - "index": 15346 - } - }, - "context": { - "loc": { - "start": { - "line": 605, - "column": 0, - "index": 15347 - }, - "end": { - "line": 605, - "column": 43, - "index": 15390 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayHeight", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayHeight", - "scope": "instance" - } - ], - "namespace": "p5#displayHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 607, - "column": 0, - "index": 15392 - }, - "end": { - "line": 631, - "column": 3, - "index": 16081 - } - }, - "context": { - "loc": { - "start": { - "line": 632, - "column": 0, - "index": 16082 - }, - "end": { - "line": 632, - "column": 44, - "index": 16126 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowWidth", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowWidth", - "scope": "instance" - } - ], - "namespace": "p5#windowWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 634, - "column": 0, - "index": 16128 - }, - "end": { - "line": 658, - "column": 3, - "index": 16819 - } - }, - "context": { - "loc": { - "start": { - "line": 659, - "column": 0, - "index": 16820 - }, - "end": { - "line": 659, - "column": 46, - "index": 16866 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowHeight", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowHeight", - "scope": "instance" - } - ], - "namespace": "p5#windowHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "width" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "width" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 750, - "column": 0, - "index": 19217 - }, - "end": { - "line": 816, - "column": 3, - "index": 20713 - } - }, - "context": { - "loc": { - "start": { - "line": 817, - "column": 0, - "index": 20714 - }, - "end": { - "line": 817, - "column": 23, - "index": 20737 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "width", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "width", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "width", - "scope": "instance" - } - ], - "namespace": "p5#width" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "height" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "height" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 819, - "column": 0, - "index": 20739 - }, - "end": { - "line": 885, - "column": 3, - "index": 22246 - } - }, - "context": { - "loc": { - "start": { - "line": 886, - "column": 0, - "index": 22247 - }, - "end": { - "line": 886, - "column": 24, - "index": 22271 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "height", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "height", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "height", - "scope": "instance" - } - ], - "namespace": "p5#height" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "nothing displayed", - "lineNumber": 20 - } - ], - "loc": { - "start": { - "line": 317, - "column": 4, - "index": 10982 - }, - "end": { - "line": 340, - "column": 7, - "index": 11811 - } - }, - "context": { - "loc": { - "start": { - "line": 341, - "column": 4, - "index": 11816 - }, - "end": { - "line": 402, - "column": 6, - "index": 13726 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "remove", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "remove", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#remove" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function does 3 things:" - } - ] - }, - { - "type": "list", - "ordered": true, - "start": 1, - "spread": true, - "children": [ - { - "type": "listItem", - "spread": true, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Bounds the desired start/stop angles for an arc (in radians) so that:" - } - ] - }, - { - "type": "code", - "lang": null, - "meta": null, - "value": "0 <= start < TWO_PI ; start <= stop < start + TWO_PI" - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This means that the arc rendering functions don't have to be concerned\nwith what happens if stop is smaller than start, or if the arc 'goes\nround more than once', etc.: they can just start at start and increase\nuntil stop and the correct arc will be drawn." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Optionally adjusts the angles within each quadrant to counter the naive\nscaling of the underlying ellipse up from the unit circle. Without\nthis, the angles become arbitrary when width != height: 45 degrees\nmight be drawn at 5 degrees on a 'wide' ellipse, or at 85 degrees on\na 'tall' ellipse." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Flags up when start and stop correspond to the same place on the\nunderlying ellipse. This is useful if you want to do something special\nthere (like rendering a whole ellipse instead)." - } - ] - } - ] - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 16, - "column": 0, - "index": 333 - }, - "end": { - "line": 37, - "column": 3, - "index": 1365 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 1366 - }, - "end": { - "line": 100, - "column": 2, - "index": 3623 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "start", - "lineNumber": 39 - }, - { - "title": "param", - "name": "stop", - "lineNumber": 40 - }, - { - "title": "param", - "name": "width", - "lineNumber": 41 - }, - { - "title": "param", - "name": "height", - "lineNumber": 42 - }, - { - "title": "param", - "name": "correctForScaling", - "lineNumber": 43 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_normalizeArcAngles", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_normalizeArcAngles", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_normalizeArcAngles" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for select and selectAll" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 6392 - }, - "end": { - "line": 193, - "column": 3, - "index": 6443 - } - }, - "context": { - "loc": { - "start": { - "line": 194, - "column": 0, - "index": 6444 - }, - "end": { - "line": 204, - "column": 2, - "index": 6751 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "p", - "lineNumber": 194 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_getContainer", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_getContainer", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_getContainer" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for getElement and getElements." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 206, - "column": 0, - "index": 6753 - }, - "end": { - "line": 208, - "column": 3, - "index": 6811 - } - }, - "context": { - "loc": { - "start": { - "line": 209, - "column": 0, - "index": 6812 - }, - "end": { - "line": 238, - "column": 2, - "index": 7767 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "elt", - "lineNumber": 209 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_wrapElement", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_wrapElement", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_wrapElement" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "INPUT *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 715, - "column": 0, - "index": 21883 - }, - "end": { - "line": 715, - "column": 13, - "index": 21896 - } - }, - "context": { - "loc": { - "start": { - "line": 827, - "column": 0, - "index": 24953 - }, - "end": { - "line": 840, - "column": 2, - "index": 25384 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "min", - "lineNumber": 827 - }, - { - "title": "param", - "name": "max", - "lineNumber": 827 - }, - { - "title": "param", - "name": "value", - "lineNumber": 827 - }, - { - "title": "param", - "name": "step", - "lineNumber": 827 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createSlider", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createSlider", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createSlider" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "AUDIO STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2041, - "column": 0, - "index": 61417 - }, - "end": { - "line": 2041, - "column": 19, - "index": 61436 - } - }, - "context": { - "loc": { - "start": { - "line": 2080, - "column": 0, - "index": 62975 - }, - "end": { - "line": 2083, - "column": 2, - "index": 63135 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "src", - "lineNumber": 2080 - }, - { - "title": "param", - "name": "callback", - "lineNumber": 2080 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createAudio", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createAudio", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createAudio" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "CAMERA STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2085, - "column": 0, - "index": 63137 - }, - "end": { - "line": 2085, - "column": 20, - "index": 63157 - } - }, - "context": { - "loc": { - "start": { - "line": 2087, - "column": 0, - "index": 63159 - }, - "end": { - "line": 2087, - "column": 29, - "index": 63188 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "VIDEO", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "VIDEO", - "scope": "instance" - } - ], - "namespace": "p5#VIDEO" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - }, - "name": "deviceOrientation" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 20, - "column": 3, - "index": 511 - } - }, - "context": { - "loc": { - "start": { - "line": 21, - "column": 0, - "index": 512 - }, - "end": { - "line": 22, - "column": 74, - "index": 619 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deviceOrientation", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deviceOrientation", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deviceOrientation", - "scope": "instance" - } - ], - "namespace": "p5#deviceOrientation" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationX always contains the acceleration of the\ndevice along the x axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 24, - "column": 0, - "index": 621 - }, - "end": { - "line": 43, - "column": 3, - "index": 1167 - } - }, - "context": { - "loc": { - "start": { - "line": 44, - "column": 0, - "index": 1168 - }, - "end": { - "line": 44, - "column": 31, - "index": 1199 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationX", - "scope": "instance" - } - ], - "namespace": "p5#accelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationY always contains the acceleration of the\ndevice along the y axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 46, - "column": 0, - "index": 1201 - }, - "end": { - "line": 65, - "column": 3, - "index": 1746 - } - }, - "context": { - "loc": { - "start": { - "line": 66, - "column": 0, - "index": 1747 - }, - "end": { - "line": 66, - "column": 31, - "index": 1778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationY", - "scope": "instance" - } - ], - "namespace": "p5#accelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationZ always contains the acceleration of the\ndevice along the z axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 68, - "column": 0, - "index": 1780 - }, - "end": { - "line": 88, - "column": 3, - "index": 2328 - } - }, - "context": { - "loc": { - "start": { - "line": 89, - "column": 0, - "index": 2329 - }, - "end": { - "line": 89, - "column": 31, - "index": 2360 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationZ", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#accelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 91, - "column": 0, - "index": 2362 - }, - "end": { - "line": 98, - "column": 3, - "index": 2625 - } - }, - "context": { - "loc": { - "start": { - "line": 99, - "column": 0, - "index": 2626 - }, - "end": { - "line": 99, - "column": 32, - "index": 2658 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationX", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationX", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 101, - "column": 0, - "index": 2660 - }, - "end": { - "line": 108, - "column": 3, - "index": 2923 - } - }, - "context": { - "loc": { - "start": { - "line": 109, - "column": 0, - "index": 2924 - }, - "end": { - "line": 109, - "column": 32, - "index": 2956 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationY", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationY", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 111, - "column": 0, - "index": 2958 - }, - "end": { - "line": 118, - "column": 3, - "index": 3221 - } - }, - "context": { - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 3222 - }, - "end": { - "line": 119, - "column": 32, - "index": 3254 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationZ", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationX always contains the rotation of the\ndevice along the x axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES, the value will be -180 to 180. If\nit is set to RADIANS, the value will be -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 132, - "column": 0, - "index": 3568 - }, - "end": { - "line": 162, - "column": 3, - "index": 4447 - } - }, - "context": { - "loc": { - "start": { - "line": 163, - "column": 0, - "index": 4448 - }, - "end": { - "line": 163, - "column": 27, - "index": 4475 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationX", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationX", - "scope": "instance" - } - ], - "namespace": "p5#rotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationY always contains the rotation of the\ndevice along the y axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 165, - "column": 0, - "index": 4477 - }, - "end": { - "line": 195, - "column": 3, - "index": 5358 - } - }, - "context": { - "loc": { - "start": { - "line": 196, - "column": 0, - "index": 5359 - }, - "end": { - "line": 196, - "column": 27, - "index": 5386 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationY", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationY", - "scope": "instance" - } - ], - "namespace": "p5#rotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationZ always contains the rotation of the\ndevice along the z axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Unlike rotationX and rotationY, this variable is available for devices\nwith a built-in compass only." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - }, - { - "title": "property", - "description": null, - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 33 - } - ], - "loc": { - "start": { - "line": 198, - "column": 0, - "index": 5388 - }, - "end": { - "line": 232, - "column": 3, - "index": 6377 - } - }, - "context": { - "loc": { - "start": { - "line": 233, - "column": 0, - "index": 6378 - }, - "end": { - "line": 233, - "column": 27, - "index": 6405 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationZ", - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationZ", - "scope": "instance" - } - ], - "namespace": "p5#rotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES,\nthe value will be -180 to 180. If it is set to RADIANS, the value will\nbe -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationX can also be used with rotationX to determine the rotate\ndirection of the device along the X-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 40 - } - ], - "loc": { - "start": { - "line": 235, - "column": 0, - "index": 6407 - }, - "end": { - "line": 276, - "column": 3, - "index": 7745 - } - }, - "context": { - "loc": { - "start": { - "line": 277, - "column": 0, - "index": 7746 - }, - "end": { - "line": 277, - "column": 28, - "index": 7774 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationX", - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationX", - "scope": "instance" - } - ], - "namespace": "p5#pRotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationY can also be used with rotationY to determine the rotate\ndirection of the device along the Y-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 39 - } - ], - "loc": { - "start": { - "line": 279, - "column": 0, - "index": 7776 - }, - "end": { - "line": 319, - "column": 3, - "index": 9113 - } - }, - "context": { - "loc": { - "start": { - "line": 320, - "column": 0, - "index": 9114 - }, - "end": { - "line": 320, - "column": 28, - "index": 9142 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationY", - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationY", - "scope": "instance" - } - ], - "namespace": "p5#pRotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationZ can also be used with rotationZ to determine the rotate\ndirection of the device along the Z-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 35 - } - ], - "loc": { - "start": { - "line": 322, - "column": 0, - "index": 9144 - }, - "end": { - "line": 358, - "column": 3, - "index": 10350 - } - }, - "context": { - "loc": { - "start": { - "line": 359, - "column": 0, - "index": 10351 - }, - "end": { - "line": 359, - "column": 28, - "index": 10379 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationZ", - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationZ", - "scope": "instance" - } - ], - "namespace": "p5#pRotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When a device is rotated, the axis that triggers the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "deviceTurned()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nmethod is stored in the turnAxis variable. The turnAxis variable is only defined within\nthe scope of deviceTurned()." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "turnAxis" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 379, - "column": 0, - "index": 10890 - }, - "end": { - "line": 412, - "column": 3, - "index": 11826 - } - }, - "context": { - "loc": { - "start": { - "line": 413, - "column": 0, - "index": 11827 - }, - "end": { - "line": 413, - "column": 34, - "index": 11861 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "turnAxis", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "turnAxis", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "turnAxis", - "scope": "instance" - } - ], - "namespace": "p5#turnAxis" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyIsPressed" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is true if any key is pressed\nand false if no keys are pressed." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "keyIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 111 - }, - "end": { - "line": 30, - "column": 3, - "index": 575 - } - }, - "context": { - "loc": { - "start": { - "line": 31, - "column": 0, - "index": 576 - }, - "end": { - "line": 31, - "column": 34, - "index": 610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "isKeyPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "isKeyPressed", - "scope": "instance" - } - ], - "namespace": "p5#isKeyPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyTyped()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". For non-ASCII keys, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyCode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nvariable." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "key" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 34, - "column": 0, - "index": 655 - }, - "end": { - "line": 57, - "column": 3, - "index": 1373 - } - }, - "context": { - "loc": { - "start": { - "line": 58, - "column": 0, - "index": 1374 - }, - "end": { - "line": 58, - "column": 22, - "index": 1396 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "key", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "key", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "key", - "scope": "instance" - } - ], - "namespace": "p5#key" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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: " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keycode.info" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "keyCode" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 60, - "column": 0, - "index": 1398 - }, - "end": { - "line": 95, - "column": 3, - "index": 2425 - } - }, - "context": { - "loc": { - "start": { - "line": 96, - "column": 0, - "index": 2426 - }, - "end": { - "line": 96, - "column": 25, - "index": 2451 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyCode", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "keyCode", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "keyCode", - "scope": "instance" - } - ], - "namespace": "p5#keyCode" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The onblur function is called when the user is no longer focused\non the p5 element. Because the keyup events will not fire if the user is\nnot focused on the element we must assume all keys currently down have\nbeen released." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 291, - "column": 0, - "index": 8735 - }, - "end": { - "line": 296, - "column": 3, - "index": 8978 - } - }, - "context": { - "loc": { - "start": { - "line": 297, - "column": 0, - "index": 8979 - }, - "end": { - "line": 299, - "column": 2, - "index": 9041 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "e", - "lineNumber": 297 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_onblur", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_onblur", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_onblur" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedX contains the horizontal movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 4 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 40, - "column": 3, - "index": 777 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 778 - }, - "end": { - "line": 41, - "column": 24, - "index": 802 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedX", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedX", - "scope": "instance" - } - ], - "namespace": "p5#movedX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedY contains the vertical movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 43, - "column": 0, - "index": 804 - }, - "end": { - "line": 70, - "column": 3, - "index": 1394 - } - }, - "context": { - "loc": { - "start": { - "line": 71, - "column": 0, - "index": 1395 - }, - "end": { - "line": 71, - "column": 24, - "index": 1419 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedY", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedY", - "scope": "instance" - } - ], - "namespace": "p5#movedY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 80, - "column": 0, - "index": 1666 - }, - "end": { - "line": 101, - "column": 3, - "index": 2316 - } - }, - "context": { - "loc": { - "start": { - "line": 102, - "column": 0, - "index": 2317 - }, - "end": { - "line": 102, - "column": 24, - "index": 2341 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseX", - "scope": "instance" - } - ], - "namespace": "p5#mouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 2343 - }, - "end": { - "line": 125, - "column": 3, - "index": 2986 - } - }, - "context": { - "loc": { - "start": { - "line": 126, - "column": 0, - "index": 2987 - }, - "end": { - "line": 126, - "column": 24, - "index": 3011 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseY", - "scope": "instance" - } - ], - "namespace": "p5#mouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 128, - "column": 0, - "index": 3013 - }, - "end": { - "line": 156, - "column": 3, - "index": 3890 - } - }, - "context": { - "loc": { - "start": { - "line": 157, - "column": 0, - "index": 3891 - }, - "end": { - "line": 157, - "column": 25, - "index": 3916 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseX", - "scope": "instance" - } - ], - "namespace": "p5#pmouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 159, - "column": 0, - "index": 3918 - }, - "end": { - "line": 186, - "column": 3, - "index": 4745 - } - }, - "context": { - "loc": { - "start": { - "line": 187, - "column": 0, - "index": 4746 - }, - "end": { - "line": 187, - "column": 25, - "index": 4771 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseY", - "scope": "instance" - } - ], - "namespace": "p5#pmouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseX always contains the current horizontal\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 189, - "column": 0, - "index": 4773 - }, - "end": { - "line": 223, - "column": 3, - "index": 5653 - } - }, - "context": { - "loc": { - "start": { - "line": 224, - "column": 0, - "index": 5654 - }, - "end": { - "line": 224, - "column": 27, - "index": 5681 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseX", - "scope": "instance" - } - ], - "namespace": "p5#winMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseY always contains the current vertical\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 226, - "column": 0, - "index": 5683 - }, - "end": { - "line": 260, - "column": 3, - "index": 6560 - } - }, - "context": { - "loc": { - "start": { - "line": 261, - "column": 0, - "index": 6561 - }, - "end": { - "line": 261, - "column": 27, - "index": 6588 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseY", - "scope": "instance" - } - ], - "namespace": "p5#winMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 263, - "column": 0, - "index": 6590 - }, - "end": { - "line": 299, - "column": 3, - "index": 7675 - } - }, - "context": { - "loc": { - "start": { - "line": 300, - "column": 0, - "index": 7676 - }, - "end": { - "line": 300, - "column": 28, - "index": 7704 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseX", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseX", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 302, - "column": 0, - "index": 7706 - }, - "end": { - "line": 338, - "column": 3, - "index": 8785 - } - }, - "context": { - "loc": { - "start": { - "line": 339, - "column": 0, - "index": 8786 - }, - "end": { - "line": 339, - "column": 28, - "index": 8814 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseY", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseY", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - }, - "name": "mouseButton" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 341, - "column": 0, - "index": 8816 - }, - "end": { - "line": 375, - "column": 3, - "index": 9715 - } - }, - "context": { - "loc": { - "start": { - "line": 376, - "column": 0, - "index": 9716 - }, - "end": { - "line": 376, - "column": 29, - "index": 9745 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseButton", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseButton", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseButton", - "scope": "instance" - } - ], - "namespace": "p5#mouseButton" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable mouseIsPressed is true if the mouse is pressed\nand false if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "mouseIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 378, - "column": 0, - "index": 9747 - }, - "end": { - "line": 404, - "column": 3, - "index": 10289 - } - }, - "context": { - "loc": { - "start": { - "line": 405, - "column": 0, - "index": 10290 - }, - "end": { - "line": 405, - "column": 36, - "index": 10326 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseIsPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseIsPressed", - "scope": "instance" - } - ], - "namespace": "p5#mouseIsPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The touches[] array is not supported on Safari and IE on touch-based\ndesktops (laptops)." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - }, - "name": "touches" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 108 - }, - "end": { - "line": 37, - "column": 3, - "index": 883 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 884 - }, - "end": { - "line": 38, - "column": 26, - "index": 910 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/touch.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "touches", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "touches", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "touches", - "scope": "instance" - } - ], - "namespace": "p5#touches" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An array containing the color of each pixel on the canvas. Colors are\nstored as numbers representing red, green, blue, and alpha (RGBA) values.\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " is a one-dimensional array for performance reasons." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Each pixel occupies four elements in the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array, one for each RGBA\nvalue. For example, the pixel at coordinates (0, 0) stores its RGBA values\nat " - }, - { - "type": "inlineCode", - "value": "pixels[0]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[1]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[2]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[3]" - }, - { - "type": "text", - "value": ", respectively.\nThe next pixel at coordinates (1, 0) stores its RGBA values at " - }, - { - "type": "inlineCode", - "value": "pixels[4]" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "inlineCode", - "value": "pixels[5]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[6]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[7]" - }, - { - "type": "text", - "value": ". And so on. The " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array\nfor a 100×100 canvas has 100 × 100 × 4 = 40,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Some displays use several smaller pixels to set the color at a single\npoint. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function returns\nthe pixel density of the canvas. High density displays often have a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " of 2. On such a display, the\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array for a 100×100 canvas has 200 × 200 × 4 =\n160,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Accessing the RGBA values for a point on the canvas requires a little math\nas shown below. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadPixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function\nmust be called before accessing the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array. The\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "updatePixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function must be called\nafter any changes are made." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "pixels" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 169 - }, - "end": { - "line": 103, - "column": 3, - "index": 3031 - } - }, - "context": { - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 3032 - }, - "end": { - "line": 104, - "column": 25, - "index": 3057 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pixels", - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pixels", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pixels", - "scope": "instance" - } - ], - "namespace": "p5#pixels" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function to measure ascent and descent." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 362, - "column": 0, - "index": 9474 - }, - "end": { - "line": 364, - "column": 3, - "index": 9531 - } - }, - "context": { - "loc": { - "start": { - "line": 365, - "column": 0, - "index": 9532 - }, - "end": { - "line": 367, - "column": 2, - "index": 9627 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_updateTextMetrics", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_updateTextMetrics", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_updateTextMetrics" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ensures that p5 is using a 3d renderer. throws an error if not." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2350, - "column": 0, - "index": 73393 - }, - "end": { - "line": 2352, - "column": 3, - "index": 73467 - } - }, - "context": { - "loc": { - "start": { - "line": 2353, - "column": 0, - "index": 73468 - }, - "end": { - "line": 2358, - "column": 2, - "index": 73742 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "name", - "lineNumber": 2353 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_assert3d", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_assert3d", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_assert3d" - } - ], - "events": [], - "static": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Turn off some features of the friendly error system (FES), which can give\na significant boost to performance when needed." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ndisabling the friendly error system" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "disableFriendlyErrors" - }, - { - "title": "example", - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 754, - "column": 0, - "index": 26038 - }, - "end": { - "line": 776, - "column": 3, - "index": 26889 - } - }, - "context": { - "loc": { - "start": { - "line": 777, - "column": 0, - "index": 26890 - }, - "end": { - "line": 777, - "column": 33, - "index": 26923 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "disableFriendlyErrors", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "disableFriendlyErrors", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "disableFriendlyErrors", - "scope": "static" - } - ], - "namespace": "p5.disableFriendlyErrors" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Path to the media element's source as a string." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.MediaElement", - "lineNumber": 3 - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "src" - }, - { - "title": "return", - "description": "src", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 4842, - "column": 0, - "index": 139686 - }, - "end": { - "line": 4868, - "column": 3, - "index": 140231 - } - }, - "context": { - "loc": { - "start": { - "line": 4958, - "column": 0, - "index": 142394 - }, - "end": { - "line": 5009, - "column": 2, - "index": 143967 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "src" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "File", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "File", - "scope": "static" - } - ], - "namespace": "p5.File" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Table Options\nGeneric class for handling tabular data, typically from a\nCSV, TSV, or other sort of spreadsheet file.\nCSV files are\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ncomma separated values" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", often with the data in quotes. TSV\nfiles use tabs as separators, and usually don't bother with the\nquotes.\nFile names should end with .csv if they're comma separated.\nA rough \"spec\" for CSV can be found\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "here" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nTo load files, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method.\nTo save tables to your computer, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "save" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method\nor the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "saveTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Possible options include:" - } - ] - }, - { - "type": "html", - "value": "
    \n
  • csv - parse the table as comma-separated values\n
  • tsv - parse the table as tab-separated values\n
  • header - this table has a header (title) row\n
" - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 93 - }, - "end": { - "line": 31, - "column": 3, - "index": 1053 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 1379 - }, - "end": { - "line": 1259, - "column": 2, - "index": 33791 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "Table", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addRow()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new row of data to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "set()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object is included as a parameter, then that row is\nduplicated and added to the table." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row to be added to the table", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - "name": "row" - }, - { - "title": "return", - "description": "the row that was added", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 47, - "column": 2, - "index": 1476 - }, - "end": { - "line": 94, - "column": 3, - "index": 2995 - } - }, - "context": { - "loc": { - "start": { - "line": 95, - "column": 2, - "index": 2998 - }, - "end": { - "line": 106, - "column": 3, - "index": 3319 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row to be added to the table" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the row that was added" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes a row from the table object." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to remove", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "id" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 108, - "column": 2, - "index": 3323 - }, - "end": { - "line": 145, - "column": 3, - "index": 4202 - } - }, - "context": { - "loc": { - "start": { - "line": 146, - "column": 2, - "index": 4205 - }, - "end": { - "line": 151, - "column": 3, - "index": 4410 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "id", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to remove" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a reference to the specified " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". The reference\ncan then be used to get and set values of the selected row." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to get", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "rowID" - }, - { - "title": "return", - "description": "p5.TableRow object", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 153, - "column": 2, - "index": 4414 - }, - "end": { - "line": 191, - "column": 3, - "index": 5463 - } - }, - "context": { - "loc": { - "start": { - "line": 192, - "column": 2, - "index": 5466 - }, - "end": { - "line": 194, - "column": 3, - "index": 5507 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "r", - "lineNumber": 192 - }, - { - "title": "param", - "name": "rowID", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to get" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Gets all rows from the table. Returns an array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Array of p5.TableRows", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 196, - "column": 2, - "index": 5511 - }, - "end": { - "line": 237, - "column": 3, - "index": 6588 - } - }, - "context": { - "loc": { - "start": { - "line": 238, - "column": 2, - "index": 6591 - }, - "end": { - "line": 240, - "column": 3, - "index": 6629 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 242, - "column": 2, - "index": 6633 - }, - "end": { - "line": 282, - "column": 3, - "index": 7805 - } - }, - "context": { - "loc": { - "start": { - "line": 283, - "column": 2, - "index": 7808 - }, - "end": { - "line": 301, - "column": 3, - "index": 8272 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 10, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 303, - "column": 2, - "index": 8276 - }, - "end": { - "line": 348, - "column": 3, - "index": 9683 - } - }, - "context": { - "loc": { - "start": { - "line": 349, - "column": 2, - "index": 9686 - }, - "end": { - "line": 366, - "column": 3, - "index": 10136 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "TableRow object", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 368, - "column": 2, - "index": 10140 - }, - "end": { - "line": 407, - "column": 3, - "index": 11362 - } - }, - "context": { - "loc": { - "start": { - "line": 408, - "column": 2, - "index": 11365 - }, - "end": { - "line": 423, - "column": 3, - "index": 11778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "TableRow object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 425, - "column": 2, - "index": 11782 - }, - "end": { - "line": 472, - "column": 3, - "index": 13226 - } - }, - "context": { - "loc": { - "start": { - "line": 473, - "column": 2, - "index": 13229 - }, - "end": { - "line": 489, - "column": 3, - "index": 13668 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all values in the specified column, and returns them\nas an array. The column may be specified by either its ID or title." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String or Number of the column to return", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "Array of column values", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 491, - "column": 2, - "index": 13672 - }, - "end": { - "line": 525, - "column": 3, - "index": 14658 - } - }, - "context": { - "loc": { - "start": { - "line": 526, - "column": 2, - "index": 14661 - }, - "end": { - "line": 538, - "column": 3, - "index": 14980 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 526 - }, - { - "title": "param", - "name": "column", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String or Number of the column to return" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of column values" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes all rows from a Table. While all rows are removed,\ncolumns and column titles are maintained." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 540, - "column": 2, - "index": 14984 - }, - "end": { - "line": 571, - "column": 3, - "index": 15789 - } - }, - "context": { - "loc": { - "start": { - "line": 572, - "column": 2, - "index": 15792 - }, - "end": { - "line": 575, - "column": 3, - "index": 15852 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clearRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "clearRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#clearRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new column to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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.)" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "title of the given column", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "title" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 577, - "column": 2, - "index": 15856 - }, - "end": { - "line": 619, - "column": 3, - "index": 17079 - } - }, - "context": { - "loc": { - "start": { - "line": 620, - "column": 2, - "index": 17082 - }, - "end": { - "line": 623, - "column": 3, - "index": 17160 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "title", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "title of the given column" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of columns in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of columns in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 625, - "column": 2, - "index": 17164 - }, - "end": { - "line": 655, - "column": 3, - "index": 17854 - } - }, - "context": { - "loc": { - "start": { - "line": 656, - "column": 2, - "index": 17857 - }, - "end": { - "line": 658, - "column": 3, - "index": 17912 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of columns in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumnCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumnCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumnCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of rows in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of rows in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 660, - "column": 2, - "index": 17916 - }, - "end": { - "line": 690, - "column": 3, - "index": 18564 - } - }, - "context": { - "loc": { - "start": { - "line": 691, - "column": 2, - "index": 18567 - }, - "end": { - "line": 693, - "column": 3, - "index": 18616 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of rows in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRowCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRowCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRowCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes any of the specified characters (or \"tokens\")." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String listing characters to be removed", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "chars" - }, - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 695, - "column": 2, - "index": 18620 - }, - "end": { - "line": 730, - "column": 3, - "index": 19601 - } - }, - "context": { - "loc": { - "start": { - "line": 731, - "column": 2, - "index": 19604 - }, - "end": { - "line": 764, - "column": 3, - "index": 20779 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "chars", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String listing characters to be removed" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeTokens", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeTokens", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeTokens" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 766, - "column": 2, - "index": 20783 - }, - "end": { - "line": 798, - "column": 3, - "index": 21711 - } - }, - "context": { - "loc": { - "start": { - "line": 799, - "column": 2, - "index": 21714 - }, - "end": { - "line": 827, - "column": 3, - "index": 22666 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "trim", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "trim", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#trim" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "removeColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "columnName (string) or ID (number)", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 829, - "column": 2, - "index": 22670 - }, - "end": { - "line": 864, - "column": 3, - "index": 23691 - } - }, - "context": { - "loc": { - "start": { - "line": 865, - "column": 2, - "index": 23694 - }, - "end": { - "line": 888, - "column": 3, - "index": 24362 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "c", - "lineNumber": 865 - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or ID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 890, - "column": 2, - "index": 24366 - }, - "end": { - "line": 932, - "column": 3, - "index": 25518 - } - }, - "context": { - "loc": { - "start": { - "line": 933, - "column": 2, - "index": 25521 - }, - "end": { - "line": 935, - "column": 3, - "index": 25590 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "set", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "set", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#set" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 937, - "column": 2, - "index": 25594 - }, - "end": { - "line": 976, - "column": 3, - "index": 26578 - } - }, - "context": { - "loc": { - "start": { - "line": 977, - "column": 2, - "index": 26581 - }, - "end": { - "line": 979, - "column": 3, - "index": 26656 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 981, - "column": 2, - "index": 26660 - }, - "end": { - "line": 1019, - "column": 3, - "index": 27767 - } - }, - "context": { - "loc": { - "start": { - "line": 1020, - "column": 2, - "index": 27770 - }, - "end": { - "line": 1022, - "column": 3, - "index": 27851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1024, - "column": 2, - "index": 27855 - }, - "end": { - "line": 1062, - "column": 3, - "index": 28842 - } - }, - "context": { - "loc": { - "start": { - "line": 1063, - "column": 2, - "index": 28845 - }, - "end": { - "line": 1065, - "column": 3, - "index": 28907 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "get", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "get", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#get" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1067, - "column": 2, - "index": 28911 - }, - "end": { - "line": 1103, - "column": 3, - "index": 29853 - } - }, - "context": { - "loc": { - "start": { - "line": 1104, - "column": 2, - "index": 29856 - }, - "end": { - "line": 1106, - "column": 3, - "index": 29924 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1108, - "column": 2, - "index": 29928 - }, - "end": { - "line": 1151, - "column": 3, - "index": 31214 - } - }, - "context": { - "loc": { - "start": { - "line": 1153, - "column": 2, - "index": 31218 - }, - "end": { - "line": 1155, - "column": 3, - "index": 31292 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Name of the column which should be used to\n title each row object (optional)", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "headerColumn" - }, - { - "title": "return", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 1157, - "column": 2, - "index": 31296 - }, - "end": { - "line": 1195, - "column": 3, - "index": 32265 - } - }, - "context": { - "loc": { - "start": { - "line": 1196, - "column": 2, - "index": 32268 - }, - "end": { - "line": 1216, - "column": 3, - "index": 32851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "headerColumn", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Name of the column which should be used to\ntitle each row object (optional)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getObject", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getObject", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getObject" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all table data and returns it as a multidimensional array." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 1218, - "column": 2, - "index": 32855 - }, - "end": { - "line": 1251, - "column": 3, - "index": 33622 - } - }, - "context": { - "loc": { - "start": { - "line": 1252, - "column": 2, - "index": 33625 - }, - "end": { - "line": 1258, - "column": 3, - "index": 33788 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getArray", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getArray" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - } - ], - "namespace": "p5.Table" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An internal class to store data that will be sent to a p5.RenderBuffer.\nThose need to eventually go into a Float32Array, so this class provides a\nvariable-length array container backed by a Float32Array so that it can be\nsent to the GPU without allocating a new array each frame." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Like a C++ vector, its fixed-length Float32Array backing its contents will\ndouble in size when it goes over its capacity." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 3, - "column": 0, - "index": 32 - }, - "end": { - "line": 27, - "column": 3, - "index": 926 - } - }, - "context": { - "loc": { - "start": { - "line": 28, - "column": 0, - "index": 927 - }, - "end": { - "line": 108, - "column": 2, - "index": 2998 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "DataArray", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a Float32Array window sized to the exact length of the data" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 35, - "column": 2, - "index": 1114 - }, - "end": { - "line": 37, - "column": 5, - "index": 1196 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 2, - "index": 1199 - }, - "end": { - "line": 40, - "column": 3, - "index": 1258 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dataArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "dataArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#dataArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A \"soft\" clear, which keeps the underlying storage size the same, but\nempties the contents of its dataArray()" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 42, - "column": 2, - "index": 1262 - }, - "end": { - "line": 45, - "column": 5, - "index": 1391 - } - }, - "context": { - "loc": { - "start": { - "line": 46, - "column": 2, - "index": 1394 - }, - "end": { - "line": 48, - "column": 3, - "index": 1428 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clear", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "clear", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#clear" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Can be used to scale a DataArray back down to fit its contents." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 50, - "column": 2, - "index": 1432 - }, - "end": { - "line": 52, - "column": 5, - "index": 1510 - } - }, - "context": { - "loc": { - "start": { - "line": 53, - "column": 2, - "index": 1513 - }, - "end": { - "line": 61, - "column": 3, - "index": 1839 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rescale", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "rescale", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#rescale" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A full reset, which allocates a new underlying Float32Array at its initial\nlength" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 63, - "column": 2, - "index": 1843 - }, - "end": { - "line": 66, - "column": 5, - "index": 1944 - } - }, - "context": { - "loc": { - "start": { - "line": 67, - "column": 2, - "index": 1947 - }, - "end": { - "line": 70, - "column": 3, - "index": 2032 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "reset", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "reset", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#reset" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Adds values to the DataArray, expanding its internal storage to\naccommodate the new items." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 72, - "column": 2, - "index": 2036 - }, - "end": { - "line": 75, - "column": 5, - "index": 2146 - } - }, - "context": { - "loc": { - "start": { - "line": 76, - "column": 2, - "index": 2149 - }, - "end": { - "line": 80, - "column": 3, - "index": 2296 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "values", - "lineNumber": 76, - "type": { - "type": "RestType" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "push", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "push", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#push" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a copy of the data from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to the index\n" - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 82, - "column": 2, - "index": 2300 - }, - "end": { - "line": 85, - "column": 5, - "index": 2409 - } - }, - "context": { - "loc": { - "start": { - "line": 86, - "column": 2, - "index": 2412 - }, - "end": { - "line": 88, - "column": 3, - "index": 2494 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 86 - }, - { - "title": "param", - "name": "to", - "lineNumber": 86 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "slice", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "slice", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#slice" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a mutable Float32Array window from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to\nthe index " - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 90, - "column": 2, - "index": 2498 - }, - "end": { - "line": 93, - "column": 5, - "index": 2618 - } - }, - "context": { - "loc": { - "start": { - "line": 94, - "column": 2, - "index": 2621 - }, - "end": { - "line": 96, - "column": 3, - "index": 2709 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 94 - }, - { - "title": "param", - "name": "to", - "lineNumber": 94 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "subArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "subArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#subArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Expand capacity of the internal storage until it can fit a target size" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 98, - "column": 2, - "index": 2713 - }, - "end": { - "line": 100, - "column": 5, - "index": 2798 - } - }, - "context": { - "loc": { - "start": { - "line": 101, - "column": 2, - "index": 2801 - }, - "end": { - "line": 107, - "column": 3, - "index": 2995 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "target", - "lineNumber": 101 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "ensureLength", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "ensureLength", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#ensureLength" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - } - ], - "namespace": "p5.DataArray" - } - ] - }, - "path": [ - { - "name": "p5", - "kind": "function" - } - ], - "namespace": "p5" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This module defines the p5 methods for the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " class\nfor drawing images to the main display canvas." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 75 - }, - "end": { - "line": 11, - "column": 3, - "index": 218 - } - }, - "context": { - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 219 - }, - "end": { - "line": 12, - "column": 30, - "index": 249 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/image.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "p5", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the number of frames drawn since the sketch started." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "frameCount" - }, - { - "type": "text", - "value": "'s value is 0 inside " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". It\nincrements by 1 each time the code in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfinishes executing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "frameCount" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 69, - "column": 0, - "index": 1553 - }, - "end": { - "line": 116, - "column": 3, - "index": 2581 - } - }, - "context": { - "loc": { - "start": { - "line": 117, - "column": 0, - "index": 2582 - }, - "end": { - "line": 117, - "column": 28, - "index": 2610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "frameCount", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "frameCount", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "frameCount", - "scope": "instance" - } - ], - "namespace": "p5#frameCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the amount of time, in milliseconds, it took for\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to draw the previous frame. " - }, - { - "type": "inlineCode", - "value": "deltaTime" - }, - { - "type": "text", - "value": " is\nuseful for simulating physics." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "deltaTime" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 2612 - }, - "end": { - "line": 161, - "column": 3, - "index": 3539 - } - }, - "context": { - "loc": { - "start": { - "line": 162, - "column": 0, - "index": 3540 - }, - "end": { - "line": 162, - "column": 27, - "index": 3567 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deltaTime", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deltaTime", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deltaTime", - "scope": "instance" - } - ], - "namespace": "p5#deltaTime" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks whether the browser window is focused and can receive user input.\n" - }, - { - "type": "inlineCode", - "value": "focused" - }, - { - "type": "text", - "value": " is " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": " if the window if focused and " - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "focused" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 164, - "column": 0, - "index": 3569 - }, - "end": { - "line": 190, - "column": 3, - "index": 4257 - } - }, - "context": { - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 4258 - }, - "end": { - "line": 191, - "column": 43, - "index": 4301 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "focused", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "focused", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "focused", - "scope": "instance" - } - ], - "namespace": "p5#focused" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A string variable with the WebGL version in use. Its value equals one of\nthe followin string constants:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL2" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl2'" - }, - { - "type": "text", - "value": "," - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl'" - }, - { - "type": "text", - "value": ", or" - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "P2D" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'p2d'" - }, - { - "type": "text", - "value": ". This is the default for 2D sketches." - } - ] - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setAttributes()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for ways to set the\nWebGL version." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - }, - "name": "webglVersion" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 12 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 466, - "column": 0, - "index": 12055 - }, - "end": { - "line": 544, - "column": 3, - "index": 13784 - } - }, - "context": { - "loc": { - "start": { - "line": 545, - "column": 0, - "index": 13785 - }, - "end": { - "line": 545, - "column": 34, - "index": 13819 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "webglVersion", - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "webglVersion", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "webglVersion", - "scope": "instance" - } - ], - "namespace": "p5#webglVersion" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayWidth" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen width can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayWidth * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 547, - "column": 0, - "index": 13821 - }, - "end": { - "line": 574, - "column": 3, - "index": 14559 - } - }, - "context": { - "loc": { - "start": { - "line": 575, - "column": 0, - "index": 14560 - }, - "end": { - "line": 575, - "column": 41, - "index": 14601 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayWidth", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayWidth", - "scope": "instance" - } - ], - "namespace": "p5#displayWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayHeight" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen height can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayHeight * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 577, - "column": 0, - "index": 14603 - }, - "end": { - "line": 604, - "column": 3, - "index": 15346 - } - }, - "context": { - "loc": { - "start": { - "line": 605, - "column": 0, - "index": 15347 - }, - "end": { - "line": 605, - "column": 43, - "index": 15390 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayHeight", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayHeight", - "scope": "instance" - } - ], - "namespace": "p5#displayHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 607, - "column": 0, - "index": 15392 - }, - "end": { - "line": 631, - "column": 3, - "index": 16081 - } - }, - "context": { - "loc": { - "start": { - "line": 632, - "column": 0, - "index": 16082 - }, - "end": { - "line": 632, - "column": 44, - "index": 16126 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowWidth", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowWidth", - "scope": "instance" - } - ], - "namespace": "p5#windowWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 634, - "column": 0, - "index": 16128 - }, - "end": { - "line": 658, - "column": 3, - "index": 16819 - } - }, - "context": { - "loc": { - "start": { - "line": 659, - "column": 0, - "index": 16820 - }, - "end": { - "line": 659, - "column": 46, - "index": 16866 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowHeight", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowHeight", - "scope": "instance" - } - ], - "namespace": "p5#windowHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "width" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "width" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 750, - "column": 0, - "index": 19217 - }, - "end": { - "line": 816, - "column": 3, - "index": 20713 - } - }, - "context": { - "loc": { - "start": { - "line": 817, - "column": 0, - "index": 20714 - }, - "end": { - "line": 817, - "column": 23, - "index": 20737 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "width", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "width", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "width", - "scope": "instance" - } - ], - "namespace": "p5#width" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "height" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "height" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 819, - "column": 0, - "index": 20739 - }, - "end": { - "line": 885, - "column": 3, - "index": 22246 - } - }, - "context": { - "loc": { - "start": { - "line": 886, - "column": 0, - "index": 22247 - }, - "end": { - "line": 886, - "column": 24, - "index": 22271 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "height", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "height", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "height", - "scope": "instance" - } - ], - "namespace": "p5#height" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "nothing displayed", - "lineNumber": 20 - } - ], - "loc": { - "start": { - "line": 317, - "column": 4, - "index": 10982 - }, - "end": { - "line": 340, - "column": 7, - "index": 11811 - } - }, - "context": { - "loc": { - "start": { - "line": 341, - "column": 4, - "index": 11816 - }, - "end": { - "line": 402, - "column": 6, - "index": 13726 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "remove", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "remove", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#remove" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function does 3 things:" - } - ] - }, - { - "type": "list", - "ordered": true, - "start": 1, - "spread": true, - "children": [ - { - "type": "listItem", - "spread": true, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Bounds the desired start/stop angles for an arc (in radians) so that:" - } - ] - }, - { - "type": "code", - "lang": null, - "meta": null, - "value": "0 <= start < TWO_PI ; start <= stop < start + TWO_PI" - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This means that the arc rendering functions don't have to be concerned\nwith what happens if stop is smaller than start, or if the arc 'goes\nround more than once', etc.: they can just start at start and increase\nuntil stop and the correct arc will be drawn." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Optionally adjusts the angles within each quadrant to counter the naive\nscaling of the underlying ellipse up from the unit circle. Without\nthis, the angles become arbitrary when width != height: 45 degrees\nmight be drawn at 5 degrees on a 'wide' ellipse, or at 85 degrees on\na 'tall' ellipse." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Flags up when start and stop correspond to the same place on the\nunderlying ellipse. This is useful if you want to do something special\nthere (like rendering a whole ellipse instead)." - } - ] - } - ] - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 16, - "column": 0, - "index": 333 - }, - "end": { - "line": 37, - "column": 3, - "index": 1365 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 1366 - }, - "end": { - "line": 100, - "column": 2, - "index": 3623 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "start", - "lineNumber": 39 - }, - { - "title": "param", - "name": "stop", - "lineNumber": 40 - }, - { - "title": "param", - "name": "width", - "lineNumber": 41 - }, - { - "title": "param", - "name": "height", - "lineNumber": 42 - }, - { - "title": "param", - "name": "correctForScaling", - "lineNumber": 43 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_normalizeArcAngles", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_normalizeArcAngles", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_normalizeArcAngles" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for select and selectAll" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 6392 - }, - "end": { - "line": 193, - "column": 3, - "index": 6443 - } - }, - "context": { - "loc": { - "start": { - "line": 194, - "column": 0, - "index": 6444 - }, - "end": { - "line": 204, - "column": 2, - "index": 6751 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "p", - "lineNumber": 194 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_getContainer", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_getContainer", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_getContainer" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for getElement and getElements." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 206, - "column": 0, - "index": 6753 - }, - "end": { - "line": 208, - "column": 3, - "index": 6811 - } - }, - "context": { - "loc": { - "start": { - "line": 209, - "column": 0, - "index": 6812 - }, - "end": { - "line": 238, - "column": 2, - "index": 7767 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "elt", - "lineNumber": 209 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_wrapElement", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_wrapElement", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_wrapElement" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "INPUT *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 715, - "column": 0, - "index": 21883 - }, - "end": { - "line": 715, - "column": 13, - "index": 21896 - } - }, - "context": { - "loc": { - "start": { - "line": 827, - "column": 0, - "index": 24953 - }, - "end": { - "line": 840, - "column": 2, - "index": 25384 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "min", - "lineNumber": 827 - }, - { - "title": "param", - "name": "max", - "lineNumber": 827 - }, - { - "title": "param", - "name": "value", - "lineNumber": 827 - }, - { - "title": "param", - "name": "step", - "lineNumber": 827 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createSlider", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createSlider", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createSlider" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "AUDIO STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2041, - "column": 0, - "index": 61417 - }, - "end": { - "line": 2041, - "column": 19, - "index": 61436 - } - }, - "context": { - "loc": { - "start": { - "line": 2080, - "column": 0, - "index": 62975 - }, - "end": { - "line": 2083, - "column": 2, - "index": 63135 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "src", - "lineNumber": 2080 - }, - { - "title": "param", - "name": "callback", - "lineNumber": 2080 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createAudio", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createAudio", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createAudio" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "CAMERA STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2085, - "column": 0, - "index": 63137 - }, - "end": { - "line": 2085, - "column": 20, - "index": 63157 - } - }, - "context": { - "loc": { - "start": { - "line": 2087, - "column": 0, - "index": 63159 - }, - "end": { - "line": 2087, - "column": 29, - "index": 63188 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "VIDEO", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "VIDEO", - "scope": "instance" - } - ], - "namespace": "p5#VIDEO" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - }, - "name": "deviceOrientation" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 20, - "column": 3, - "index": 511 - } - }, - "context": { - "loc": { - "start": { - "line": 21, - "column": 0, - "index": 512 - }, - "end": { - "line": 22, - "column": 74, - "index": 619 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deviceOrientation", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deviceOrientation", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deviceOrientation", - "scope": "instance" - } - ], - "namespace": "p5#deviceOrientation" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationX always contains the acceleration of the\ndevice along the x axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 24, - "column": 0, - "index": 621 - }, - "end": { - "line": 43, - "column": 3, - "index": 1167 - } - }, - "context": { - "loc": { - "start": { - "line": 44, - "column": 0, - "index": 1168 - }, - "end": { - "line": 44, - "column": 31, - "index": 1199 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationX", - "scope": "instance" - } - ], - "namespace": "p5#accelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationY always contains the acceleration of the\ndevice along the y axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 46, - "column": 0, - "index": 1201 - }, - "end": { - "line": 65, - "column": 3, - "index": 1746 - } - }, - "context": { - "loc": { - "start": { - "line": 66, - "column": 0, - "index": 1747 - }, - "end": { - "line": 66, - "column": 31, - "index": 1778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationY", - "scope": "instance" - } - ], - "namespace": "p5#accelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationZ always contains the acceleration of the\ndevice along the z axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 68, - "column": 0, - "index": 1780 - }, - "end": { - "line": 88, - "column": 3, - "index": 2328 - } - }, - "context": { - "loc": { - "start": { - "line": 89, - "column": 0, - "index": 2329 - }, - "end": { - "line": 89, - "column": 31, - "index": 2360 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationZ", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#accelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 91, - "column": 0, - "index": 2362 - }, - "end": { - "line": 98, - "column": 3, - "index": 2625 - } - }, - "context": { - "loc": { - "start": { - "line": 99, - "column": 0, - "index": 2626 - }, - "end": { - "line": 99, - "column": 32, - "index": 2658 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationX", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationX", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 101, - "column": 0, - "index": 2660 - }, - "end": { - "line": 108, - "column": 3, - "index": 2923 - } - }, - "context": { - "loc": { - "start": { - "line": 109, - "column": 0, - "index": 2924 - }, - "end": { - "line": 109, - "column": 32, - "index": 2956 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationY", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationY", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 111, - "column": 0, - "index": 2958 - }, - "end": { - "line": 118, - "column": 3, - "index": 3221 - } - }, - "context": { - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 3222 - }, - "end": { - "line": 119, - "column": 32, - "index": 3254 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationZ", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationX always contains the rotation of the\ndevice along the x axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES, the value will be -180 to 180. If\nit is set to RADIANS, the value will be -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 132, - "column": 0, - "index": 3568 - }, - "end": { - "line": 162, - "column": 3, - "index": 4447 - } - }, - "context": { - "loc": { - "start": { - "line": 163, - "column": 0, - "index": 4448 - }, - "end": { - "line": 163, - "column": 27, - "index": 4475 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationX", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationX", - "scope": "instance" - } - ], - "namespace": "p5#rotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationY always contains the rotation of the\ndevice along the y axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 165, - "column": 0, - "index": 4477 - }, - "end": { - "line": 195, - "column": 3, - "index": 5358 - } - }, - "context": { - "loc": { - "start": { - "line": 196, - "column": 0, - "index": 5359 - }, - "end": { - "line": 196, - "column": 27, - "index": 5386 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationY", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationY", - "scope": "instance" - } - ], - "namespace": "p5#rotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationZ always contains the rotation of the\ndevice along the z axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Unlike rotationX and rotationY, this variable is available for devices\nwith a built-in compass only." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - }, - { - "title": "property", - "description": null, - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 33 - } - ], - "loc": { - "start": { - "line": 198, - "column": 0, - "index": 5388 - }, - "end": { - "line": 232, - "column": 3, - "index": 6377 - } - }, - "context": { - "loc": { - "start": { - "line": 233, - "column": 0, - "index": 6378 - }, - "end": { - "line": 233, - "column": 27, - "index": 6405 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationZ", - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationZ", - "scope": "instance" - } - ], - "namespace": "p5#rotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES,\nthe value will be -180 to 180. If it is set to RADIANS, the value will\nbe -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationX can also be used with rotationX to determine the rotate\ndirection of the device along the X-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 40 - } - ], - "loc": { - "start": { - "line": 235, - "column": 0, - "index": 6407 - }, - "end": { - "line": 276, - "column": 3, - "index": 7745 - } - }, - "context": { - "loc": { - "start": { - "line": 277, - "column": 0, - "index": 7746 - }, - "end": { - "line": 277, - "column": 28, - "index": 7774 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationX", - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationX", - "scope": "instance" - } - ], - "namespace": "p5#pRotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationY can also be used with rotationY to determine the rotate\ndirection of the device along the Y-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 39 - } - ], - "loc": { - "start": { - "line": 279, - "column": 0, - "index": 7776 - }, - "end": { - "line": 319, - "column": 3, - "index": 9113 - } - }, - "context": { - "loc": { - "start": { - "line": 320, - "column": 0, - "index": 9114 - }, - "end": { - "line": 320, - "column": 28, - "index": 9142 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationY", - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationY", - "scope": "instance" - } - ], - "namespace": "p5#pRotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationZ can also be used with rotationZ to determine the rotate\ndirection of the device along the Z-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 35 - } - ], - "loc": { - "start": { - "line": 322, - "column": 0, - "index": 9144 - }, - "end": { - "line": 358, - "column": 3, - "index": 10350 - } - }, - "context": { - "loc": { - "start": { - "line": 359, - "column": 0, - "index": 10351 - }, - "end": { - "line": 359, - "column": 28, - "index": 10379 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationZ", - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationZ", - "scope": "instance" - } - ], - "namespace": "p5#pRotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When a device is rotated, the axis that triggers the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "deviceTurned()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nmethod is stored in the turnAxis variable. The turnAxis variable is only defined within\nthe scope of deviceTurned()." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "turnAxis" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 379, - "column": 0, - "index": 10890 - }, - "end": { - "line": 412, - "column": 3, - "index": 11826 - } - }, - "context": { - "loc": { - "start": { - "line": 413, - "column": 0, - "index": 11827 - }, - "end": { - "line": 413, - "column": 34, - "index": 11861 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "turnAxis", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "turnAxis", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "turnAxis", - "scope": "instance" - } - ], - "namespace": "p5#turnAxis" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyIsPressed" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is true if any key is pressed\nand false if no keys are pressed." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "keyIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 111 - }, - "end": { - "line": 30, - "column": 3, - "index": 575 - } - }, - "context": { - "loc": { - "start": { - "line": 31, - "column": 0, - "index": 576 - }, - "end": { - "line": 31, - "column": 34, - "index": 610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "isKeyPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "isKeyPressed", - "scope": "instance" - } - ], - "namespace": "p5#isKeyPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyTyped()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". For non-ASCII keys, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyCode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nvariable." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "key" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 34, - "column": 0, - "index": 655 - }, - "end": { - "line": 57, - "column": 3, - "index": 1373 - } - }, - "context": { - "loc": { - "start": { - "line": 58, - "column": 0, - "index": 1374 - }, - "end": { - "line": 58, - "column": 22, - "index": 1396 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "key", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "key", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "key", - "scope": "instance" - } - ], - "namespace": "p5#key" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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: " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keycode.info" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "keyCode" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 60, - "column": 0, - "index": 1398 - }, - "end": { - "line": 95, - "column": 3, - "index": 2425 - } - }, - "context": { - "loc": { - "start": { - "line": 96, - "column": 0, - "index": 2426 - }, - "end": { - "line": 96, - "column": 25, - "index": 2451 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyCode", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "keyCode", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "keyCode", - "scope": "instance" - } - ], - "namespace": "p5#keyCode" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The onblur function is called when the user is no longer focused\non the p5 element. Because the keyup events will not fire if the user is\nnot focused on the element we must assume all keys currently down have\nbeen released." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 291, - "column": 0, - "index": 8735 - }, - "end": { - "line": 296, - "column": 3, - "index": 8978 - } - }, - "context": { - "loc": { - "start": { - "line": 297, - "column": 0, - "index": 8979 - }, - "end": { - "line": 299, - "column": 2, - "index": 9041 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "e", - "lineNumber": 297 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_onblur", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_onblur", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_onblur" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedX contains the horizontal movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 4 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 40, - "column": 3, - "index": 777 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 778 - }, - "end": { - "line": 41, - "column": 24, - "index": 802 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedX", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedX", - "scope": "instance" - } - ], - "namespace": "p5#movedX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedY contains the vertical movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 43, - "column": 0, - "index": 804 - }, - "end": { - "line": 70, - "column": 3, - "index": 1394 - } - }, - "context": { - "loc": { - "start": { - "line": 71, - "column": 0, - "index": 1395 - }, - "end": { - "line": 71, - "column": 24, - "index": 1419 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedY", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedY", - "scope": "instance" - } - ], - "namespace": "p5#movedY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 80, - "column": 0, - "index": 1666 - }, - "end": { - "line": 101, - "column": 3, - "index": 2316 - } - }, - "context": { - "loc": { - "start": { - "line": 102, - "column": 0, - "index": 2317 - }, - "end": { - "line": 102, - "column": 24, - "index": 2341 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseX", - "scope": "instance" - } - ], - "namespace": "p5#mouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 2343 - }, - "end": { - "line": 125, - "column": 3, - "index": 2986 - } - }, - "context": { - "loc": { - "start": { - "line": 126, - "column": 0, - "index": 2987 - }, - "end": { - "line": 126, - "column": 24, - "index": 3011 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseY", - "scope": "instance" - } - ], - "namespace": "p5#mouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 128, - "column": 0, - "index": 3013 - }, - "end": { - "line": 156, - "column": 3, - "index": 3890 - } - }, - "context": { - "loc": { - "start": { - "line": 157, - "column": 0, - "index": 3891 - }, - "end": { - "line": 157, - "column": 25, - "index": 3916 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseX", - "scope": "instance" - } - ], - "namespace": "p5#pmouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 159, - "column": 0, - "index": 3918 - }, - "end": { - "line": 186, - "column": 3, - "index": 4745 - } - }, - "context": { - "loc": { - "start": { - "line": 187, - "column": 0, - "index": 4746 - }, - "end": { - "line": 187, - "column": 25, - "index": 4771 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseY", - "scope": "instance" - } - ], - "namespace": "p5#pmouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseX always contains the current horizontal\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 189, - "column": 0, - "index": 4773 - }, - "end": { - "line": 223, - "column": 3, - "index": 5653 - } - }, - "context": { - "loc": { - "start": { - "line": 224, - "column": 0, - "index": 5654 - }, - "end": { - "line": 224, - "column": 27, - "index": 5681 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseX", - "scope": "instance" - } - ], - "namespace": "p5#winMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseY always contains the current vertical\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 226, - "column": 0, - "index": 5683 - }, - "end": { - "line": 260, - "column": 3, - "index": 6560 - } - }, - "context": { - "loc": { - "start": { - "line": 261, - "column": 0, - "index": 6561 - }, - "end": { - "line": 261, - "column": 27, - "index": 6588 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseY", - "scope": "instance" - } - ], - "namespace": "p5#winMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 263, - "column": 0, - "index": 6590 - }, - "end": { - "line": 299, - "column": 3, - "index": 7675 - } - }, - "context": { - "loc": { - "start": { - "line": 300, - "column": 0, - "index": 7676 - }, - "end": { - "line": 300, - "column": 28, - "index": 7704 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseX", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseX", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 302, - "column": 0, - "index": 7706 - }, - "end": { - "line": 338, - "column": 3, - "index": 8785 - } - }, - "context": { - "loc": { - "start": { - "line": 339, - "column": 0, - "index": 8786 - }, - "end": { - "line": 339, - "column": 28, - "index": 8814 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseY", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseY", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - }, - "name": "mouseButton" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 341, - "column": 0, - "index": 8816 - }, - "end": { - "line": 375, - "column": 3, - "index": 9715 - } - }, - "context": { - "loc": { - "start": { - "line": 376, - "column": 0, - "index": 9716 - }, - "end": { - "line": 376, - "column": 29, - "index": 9745 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseButton", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseButton", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseButton", - "scope": "instance" - } - ], - "namespace": "p5#mouseButton" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable mouseIsPressed is true if the mouse is pressed\nand false if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "mouseIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 378, - "column": 0, - "index": 9747 - }, - "end": { - "line": 404, - "column": 3, - "index": 10289 - } - }, - "context": { - "loc": { - "start": { - "line": 405, - "column": 0, - "index": 10290 - }, - "end": { - "line": 405, - "column": 36, - "index": 10326 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseIsPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseIsPressed", - "scope": "instance" - } - ], - "namespace": "p5#mouseIsPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The touches[] array is not supported on Safari and IE on touch-based\ndesktops (laptops)." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - }, - "name": "touches" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 108 - }, - "end": { - "line": 37, - "column": 3, - "index": 883 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 884 - }, - "end": { - "line": 38, - "column": 26, - "index": 910 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/touch.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "touches", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "touches", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "touches", - "scope": "instance" - } - ], - "namespace": "p5#touches" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An array containing the color of each pixel on the canvas. Colors are\nstored as numbers representing red, green, blue, and alpha (RGBA) values.\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " is a one-dimensional array for performance reasons." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Each pixel occupies four elements in the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array, one for each RGBA\nvalue. For example, the pixel at coordinates (0, 0) stores its RGBA values\nat " - }, - { - "type": "inlineCode", - "value": "pixels[0]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[1]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[2]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[3]" - }, - { - "type": "text", - "value": ", respectively.\nThe next pixel at coordinates (1, 0) stores its RGBA values at " - }, - { - "type": "inlineCode", - "value": "pixels[4]" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "inlineCode", - "value": "pixels[5]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[6]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[7]" - }, - { - "type": "text", - "value": ". And so on. The " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array\nfor a 100×100 canvas has 100 × 100 × 4 = 40,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Some displays use several smaller pixels to set the color at a single\npoint. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function returns\nthe pixel density of the canvas. High density displays often have a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " of 2. On such a display, the\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array for a 100×100 canvas has 200 × 200 × 4 =\n160,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Accessing the RGBA values for a point on the canvas requires a little math\nas shown below. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadPixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function\nmust be called before accessing the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array. The\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "updatePixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function must be called\nafter any changes are made." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "pixels" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 169 - }, - "end": { - "line": 103, - "column": 3, - "index": 3031 - } - }, - "context": { - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 3032 - }, - "end": { - "line": 104, - "column": 25, - "index": 3057 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pixels", - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pixels", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pixels", - "scope": "instance" - } - ], - "namespace": "p5#pixels" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function to measure ascent and descent." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 362, - "column": 0, - "index": 9474 - }, - "end": { - "line": 364, - "column": 3, - "index": 9531 - } - }, - "context": { - "loc": { - "start": { - "line": 365, - "column": 0, - "index": 9532 - }, - "end": { - "line": 367, - "column": 2, - "index": 9627 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_updateTextMetrics", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_updateTextMetrics", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_updateTextMetrics" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ensures that p5 is using a 3d renderer. throws an error if not." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2350, - "column": 0, - "index": 73393 - }, - "end": { - "line": 2352, - "column": 3, - "index": 73467 - } - }, - "context": { - "loc": { - "start": { - "line": 2353, - "column": 0, - "index": 73468 - }, - "end": { - "line": 2358, - "column": 2, - "index": 73742 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "name", - "lineNumber": 2353 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_assert3d", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_assert3d", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_assert3d" - } - ], - "events": [], - "static": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Turn off some features of the friendly error system (FES), which can give\na significant boost to performance when needed." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ndisabling the friendly error system" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "disableFriendlyErrors" - }, - { - "title": "example", - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 754, - "column": 0, - "index": 26038 - }, - "end": { - "line": 776, - "column": 3, - "index": 26889 - } - }, - "context": { - "loc": { - "start": { - "line": 777, - "column": 0, - "index": 26890 - }, - "end": { - "line": 777, - "column": 33, - "index": 26923 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "disableFriendlyErrors", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "disableFriendlyErrors", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "disableFriendlyErrors", - "scope": "static" - } - ], - "namespace": "p5.disableFriendlyErrors" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Path to the media element's source as a string." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.MediaElement", - "lineNumber": 3 - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "src" - }, - { - "title": "return", - "description": "src", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 4842, - "column": 0, - "index": 139686 - }, - "end": { - "line": 4868, - "column": 3, - "index": 140231 - } - }, - "context": { - "loc": { - "start": { - "line": 4958, - "column": 0, - "index": 142394 - }, - "end": { - "line": 5009, - "column": 2, - "index": 143967 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "src" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "File", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "File", - "scope": "static" - } - ], - "namespace": "p5.File" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Table Options\nGeneric class for handling tabular data, typically from a\nCSV, TSV, or other sort of spreadsheet file.\nCSV files are\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ncomma separated values" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", often with the data in quotes. TSV\nfiles use tabs as separators, and usually don't bother with the\nquotes.\nFile names should end with .csv if they're comma separated.\nA rough \"spec\" for CSV can be found\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "here" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nTo load files, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method.\nTo save tables to your computer, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "save" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method\nor the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "saveTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Possible options include:" - } - ] - }, - { - "type": "html", - "value": "
    \n
  • csv - parse the table as comma-separated values\n
  • tsv - parse the table as tab-separated values\n
  • header - this table has a header (title) row\n
" - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 93 - }, - "end": { - "line": 31, - "column": 3, - "index": 1053 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 1379 - }, - "end": { - "line": 1259, - "column": 2, - "index": 33791 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "Table", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addRow()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new row of data to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "set()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object is included as a parameter, then that row is\nduplicated and added to the table." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row to be added to the table", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - "name": "row" - }, - { - "title": "return", - "description": "the row that was added", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 47, - "column": 2, - "index": 1476 - }, - "end": { - "line": 94, - "column": 3, - "index": 2995 - } - }, - "context": { - "loc": { - "start": { - "line": 95, - "column": 2, - "index": 2998 - }, - "end": { - "line": 106, - "column": 3, - "index": 3319 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row to be added to the table" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the row that was added" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes a row from the table object." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to remove", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "id" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 108, - "column": 2, - "index": 3323 - }, - "end": { - "line": 145, - "column": 3, - "index": 4202 - } - }, - "context": { - "loc": { - "start": { - "line": 146, - "column": 2, - "index": 4205 - }, - "end": { - "line": 151, - "column": 3, - "index": 4410 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "id", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to remove" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a reference to the specified " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". The reference\ncan then be used to get and set values of the selected row." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to get", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "rowID" - }, - { - "title": "return", - "description": "p5.TableRow object", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 153, - "column": 2, - "index": 4414 - }, - "end": { - "line": 191, - "column": 3, - "index": 5463 - } - }, - "context": { - "loc": { - "start": { - "line": 192, - "column": 2, - "index": 5466 - }, - "end": { - "line": 194, - "column": 3, - "index": 5507 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "r", - "lineNumber": 192 - }, - { - "title": "param", - "name": "rowID", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to get" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Gets all rows from the table. Returns an array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Array of p5.TableRows", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 196, - "column": 2, - "index": 5511 - }, - "end": { - "line": 237, - "column": 3, - "index": 6588 - } - }, - "context": { - "loc": { - "start": { - "line": 238, - "column": 2, - "index": 6591 - }, - "end": { - "line": 240, - "column": 3, - "index": 6629 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 242, - "column": 2, - "index": 6633 - }, - "end": { - "line": 282, - "column": 3, - "index": 7805 - } - }, - "context": { - "loc": { - "start": { - "line": 283, - "column": 2, - "index": 7808 - }, - "end": { - "line": 301, - "column": 3, - "index": 8272 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 10, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 303, - "column": 2, - "index": 8276 - }, - "end": { - "line": 348, - "column": 3, - "index": 9683 - } - }, - "context": { - "loc": { - "start": { - "line": 349, - "column": 2, - "index": 9686 - }, - "end": { - "line": 366, - "column": 3, - "index": 10136 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "TableRow object", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 368, - "column": 2, - "index": 10140 - }, - "end": { - "line": 407, - "column": 3, - "index": 11362 - } - }, - "context": { - "loc": { - "start": { - "line": 408, - "column": 2, - "index": 11365 - }, - "end": { - "line": 423, - "column": 3, - "index": 11778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "TableRow object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 425, - "column": 2, - "index": 11782 - }, - "end": { - "line": 472, - "column": 3, - "index": 13226 - } - }, - "context": { - "loc": { - "start": { - "line": 473, - "column": 2, - "index": 13229 - }, - "end": { - "line": 489, - "column": 3, - "index": 13668 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all values in the specified column, and returns them\nas an array. The column may be specified by either its ID or title." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String or Number of the column to return", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "Array of column values", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 491, - "column": 2, - "index": 13672 - }, - "end": { - "line": 525, - "column": 3, - "index": 14658 - } - }, - "context": { - "loc": { - "start": { - "line": 526, - "column": 2, - "index": 14661 - }, - "end": { - "line": 538, - "column": 3, - "index": 14980 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 526 - }, - { - "title": "param", - "name": "column", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String or Number of the column to return" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of column values" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes all rows from a Table. While all rows are removed,\ncolumns and column titles are maintained." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 540, - "column": 2, - "index": 14984 - }, - "end": { - "line": 571, - "column": 3, - "index": 15789 - } - }, - "context": { - "loc": { - "start": { - "line": 572, - "column": 2, - "index": 15792 - }, - "end": { - "line": 575, - "column": 3, - "index": 15852 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clearRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "clearRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#clearRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new column to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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.)" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "title of the given column", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "title" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 577, - "column": 2, - "index": 15856 - }, - "end": { - "line": 619, - "column": 3, - "index": 17079 - } - }, - "context": { - "loc": { - "start": { - "line": 620, - "column": 2, - "index": 17082 - }, - "end": { - "line": 623, - "column": 3, - "index": 17160 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "title", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "title of the given column" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of columns in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of columns in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 625, - "column": 2, - "index": 17164 - }, - "end": { - "line": 655, - "column": 3, - "index": 17854 - } - }, - "context": { - "loc": { - "start": { - "line": 656, - "column": 2, - "index": 17857 - }, - "end": { - "line": 658, - "column": 3, - "index": 17912 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of columns in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumnCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumnCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumnCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of rows in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of rows in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 660, - "column": 2, - "index": 17916 - }, - "end": { - "line": 690, - "column": 3, - "index": 18564 - } - }, - "context": { - "loc": { - "start": { - "line": 691, - "column": 2, - "index": 18567 - }, - "end": { - "line": 693, - "column": 3, - "index": 18616 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of rows in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRowCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRowCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRowCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes any of the specified characters (or \"tokens\")." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String listing characters to be removed", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "chars" - }, - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 695, - "column": 2, - "index": 18620 - }, - "end": { - "line": 730, - "column": 3, - "index": 19601 - } - }, - "context": { - "loc": { - "start": { - "line": 731, - "column": 2, - "index": 19604 - }, - "end": { - "line": 764, - "column": 3, - "index": 20779 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "chars", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String listing characters to be removed" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeTokens", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeTokens", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeTokens" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 766, - "column": 2, - "index": 20783 - }, - "end": { - "line": 798, - "column": 3, - "index": 21711 - } - }, - "context": { - "loc": { - "start": { - "line": 799, - "column": 2, - "index": 21714 - }, - "end": { - "line": 827, - "column": 3, - "index": 22666 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "trim", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "trim", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#trim" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "removeColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "columnName (string) or ID (number)", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 829, - "column": 2, - "index": 22670 - }, - "end": { - "line": 864, - "column": 3, - "index": 23691 - } - }, - "context": { - "loc": { - "start": { - "line": 865, - "column": 2, - "index": 23694 - }, - "end": { - "line": 888, - "column": 3, - "index": 24362 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "c", - "lineNumber": 865 - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or ID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 890, - "column": 2, - "index": 24366 - }, - "end": { - "line": 932, - "column": 3, - "index": 25518 - } - }, - "context": { - "loc": { - "start": { - "line": 933, - "column": 2, - "index": 25521 - }, - "end": { - "line": 935, - "column": 3, - "index": 25590 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "set", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "set", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#set" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 937, - "column": 2, - "index": 25594 - }, - "end": { - "line": 976, - "column": 3, - "index": 26578 - } - }, - "context": { - "loc": { - "start": { - "line": 977, - "column": 2, - "index": 26581 - }, - "end": { - "line": 979, - "column": 3, - "index": 26656 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 981, - "column": 2, - "index": 26660 - }, - "end": { - "line": 1019, - "column": 3, - "index": 27767 - } - }, - "context": { - "loc": { - "start": { - "line": 1020, - "column": 2, - "index": 27770 - }, - "end": { - "line": 1022, - "column": 3, - "index": 27851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1024, - "column": 2, - "index": 27855 - }, - "end": { - "line": 1062, - "column": 3, - "index": 28842 - } - }, - "context": { - "loc": { - "start": { - "line": 1063, - "column": 2, - "index": 28845 - }, - "end": { - "line": 1065, - "column": 3, - "index": 28907 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "get", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "get", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#get" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1067, - "column": 2, - "index": 28911 - }, - "end": { - "line": 1103, - "column": 3, - "index": 29853 - } - }, - "context": { - "loc": { - "start": { - "line": 1104, - "column": 2, - "index": 29856 - }, - "end": { - "line": 1106, - "column": 3, - "index": 29924 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1108, - "column": 2, - "index": 29928 - }, - "end": { - "line": 1151, - "column": 3, - "index": 31214 - } - }, - "context": { - "loc": { - "start": { - "line": 1153, - "column": 2, - "index": 31218 - }, - "end": { - "line": 1155, - "column": 3, - "index": 31292 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Name of the column which should be used to\n title each row object (optional)", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "headerColumn" - }, - { - "title": "return", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 1157, - "column": 2, - "index": 31296 - }, - "end": { - "line": 1195, - "column": 3, - "index": 32265 - } - }, - "context": { - "loc": { - "start": { - "line": 1196, - "column": 2, - "index": 32268 - }, - "end": { - "line": 1216, - "column": 3, - "index": 32851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "headerColumn", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Name of the column which should be used to\ntitle each row object (optional)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getObject", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getObject", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getObject" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all table data and returns it as a multidimensional array." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 1218, - "column": 2, - "index": 32855 - }, - "end": { - "line": 1251, - "column": 3, - "index": 33622 - } - }, - "context": { - "loc": { - "start": { - "line": 1252, - "column": 2, - "index": 33625 - }, - "end": { - "line": 1258, - "column": 3, - "index": 33788 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getArray", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getArray" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - } - ], - "namespace": "p5.Table" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An internal class to store data that will be sent to a p5.RenderBuffer.\nThose need to eventually go into a Float32Array, so this class provides a\nvariable-length array container backed by a Float32Array so that it can be\nsent to the GPU without allocating a new array each frame." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Like a C++ vector, its fixed-length Float32Array backing its contents will\ndouble in size when it goes over its capacity." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 3, - "column": 0, - "index": 32 - }, - "end": { - "line": 27, - "column": 3, - "index": 926 - } - }, - "context": { - "loc": { - "start": { - "line": 28, - "column": 0, - "index": 927 - }, - "end": { - "line": 108, - "column": 2, - "index": 2998 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "DataArray", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a Float32Array window sized to the exact length of the data" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 35, - "column": 2, - "index": 1114 - }, - "end": { - "line": 37, - "column": 5, - "index": 1196 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 2, - "index": 1199 - }, - "end": { - "line": 40, - "column": 3, - "index": 1258 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dataArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "dataArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#dataArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A \"soft\" clear, which keeps the underlying storage size the same, but\nempties the contents of its dataArray()" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 42, - "column": 2, - "index": 1262 - }, - "end": { - "line": 45, - "column": 5, - "index": 1391 - } - }, - "context": { - "loc": { - "start": { - "line": 46, - "column": 2, - "index": 1394 - }, - "end": { - "line": 48, - "column": 3, - "index": 1428 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clear", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "clear", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#clear" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Can be used to scale a DataArray back down to fit its contents." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 50, - "column": 2, - "index": 1432 - }, - "end": { - "line": 52, - "column": 5, - "index": 1510 - } - }, - "context": { - "loc": { - "start": { - "line": 53, - "column": 2, - "index": 1513 - }, - "end": { - "line": 61, - "column": 3, - "index": 1839 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rescale", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "rescale", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#rescale" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A full reset, which allocates a new underlying Float32Array at its initial\nlength" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 63, - "column": 2, - "index": 1843 - }, - "end": { - "line": 66, - "column": 5, - "index": 1944 - } - }, - "context": { - "loc": { - "start": { - "line": 67, - "column": 2, - "index": 1947 - }, - "end": { - "line": 70, - "column": 3, - "index": 2032 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "reset", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "reset", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#reset" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Adds values to the DataArray, expanding its internal storage to\naccommodate the new items." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 72, - "column": 2, - "index": 2036 - }, - "end": { - "line": 75, - "column": 5, - "index": 2146 - } - }, - "context": { - "loc": { - "start": { - "line": 76, - "column": 2, - "index": 2149 - }, - "end": { - "line": 80, - "column": 3, - "index": 2296 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "values", - "lineNumber": 76, - "type": { - "type": "RestType" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "push", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "push", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#push" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a copy of the data from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to the index\n" - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 82, - "column": 2, - "index": 2300 - }, - "end": { - "line": 85, - "column": 5, - "index": 2409 - } - }, - "context": { - "loc": { - "start": { - "line": 86, - "column": 2, - "index": 2412 - }, - "end": { - "line": 88, - "column": 3, - "index": 2494 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 86 - }, - { - "title": "param", - "name": "to", - "lineNumber": 86 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "slice", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "slice", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#slice" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a mutable Float32Array window from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to\nthe index " - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 90, - "column": 2, - "index": 2498 - }, - "end": { - "line": 93, - "column": 5, - "index": 2618 - } - }, - "context": { - "loc": { - "start": { - "line": 94, - "column": 2, - "index": 2621 - }, - "end": { - "line": 96, - "column": 3, - "index": 2709 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 94 - }, - { - "title": "param", - "name": "to", - "lineNumber": 94 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "subArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "subArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#subArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Expand capacity of the internal storage until it can fit a target size" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 98, - "column": 2, - "index": 2713 - }, - "end": { - "line": 100, - "column": 5, - "index": 2798 - } - }, - "context": { - "loc": { - "start": { - "line": 101, - "column": 2, - "index": 2801 - }, - "end": { - "line": 107, - "column": 3, - "index": 2995 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "target", - "lineNumber": 101 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "ensureLength", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "ensureLength", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#ensureLength" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - } - ], - "namespace": "p5.DataArray" - } - ] - }, - "path": [ - { - "name": "p5" - } - ], - "namespace": "p5" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This module defines the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " class and P5 methods for\ndrawing images to the main display canvas." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 108 - }, - "end": { - "line": 12, - "column": 3, - "index": 247 - } - }, - "context": { - "loc": { - "start": { - "line": 14, - "column": 0, - "index": 249 - }, - "end": { - "line": 14, - "column": 30, - "index": 279 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "p5", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the number of frames drawn since the sketch started." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "frameCount" - }, - { - "type": "text", - "value": "'s value is 0 inside " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". It\nincrements by 1 each time the code in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfinishes executing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "frameCount" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 69, - "column": 0, - "index": 1553 - }, - "end": { - "line": 116, - "column": 3, - "index": 2581 - } - }, - "context": { - "loc": { - "start": { - "line": 117, - "column": 0, - "index": 2582 - }, - "end": { - "line": 117, - "column": 28, - "index": 2610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "frameCount", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "frameCount", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "frameCount", - "scope": "instance" - } - ], - "namespace": "p5#frameCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the amount of time, in milliseconds, it took for\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to draw the previous frame. " - }, - { - "type": "inlineCode", - "value": "deltaTime" - }, - { - "type": "text", - "value": " is\nuseful for simulating physics." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "deltaTime" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 2612 - }, - "end": { - "line": 161, - "column": 3, - "index": 3539 - } - }, - "context": { - "loc": { - "start": { - "line": 162, - "column": 0, - "index": 3540 - }, - "end": { - "line": 162, - "column": 27, - "index": 3567 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deltaTime", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deltaTime", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deltaTime", - "scope": "instance" - } - ], - "namespace": "p5#deltaTime" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks whether the browser window is focused and can receive user input.\n" - }, - { - "type": "inlineCode", - "value": "focused" - }, - { - "type": "text", - "value": " is " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": " if the window if focused and " - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "focused" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 164, - "column": 0, - "index": 3569 - }, - "end": { - "line": 190, - "column": 3, - "index": 4257 - } - }, - "context": { - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 4258 - }, - "end": { - "line": 191, - "column": 43, - "index": 4301 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "focused", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "focused", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "focused", - "scope": "instance" - } - ], - "namespace": "p5#focused" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A string variable with the WebGL version in use. Its value equals one of\nthe followin string constants:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL2" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl2'" - }, - { - "type": "text", - "value": "," - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl'" - }, - { - "type": "text", - "value": ", or" - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "P2D" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'p2d'" - }, - { - "type": "text", - "value": ". This is the default for 2D sketches." - } - ] - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setAttributes()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for ways to set the\nWebGL version." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - }, - "name": "webglVersion" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 12 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 466, - "column": 0, - "index": 12055 - }, - "end": { - "line": 544, - "column": 3, - "index": 13784 - } - }, - "context": { - "loc": { - "start": { - "line": 545, - "column": 0, - "index": 13785 - }, - "end": { - "line": 545, - "column": 34, - "index": 13819 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "webglVersion", - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "webglVersion", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "webglVersion", - "scope": "instance" - } - ], - "namespace": "p5#webglVersion" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayWidth" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen width can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayWidth * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 547, - "column": 0, - "index": 13821 - }, - "end": { - "line": 574, - "column": 3, - "index": 14559 - } - }, - "context": { - "loc": { - "start": { - "line": 575, - "column": 0, - "index": 14560 - }, - "end": { - "line": 575, - "column": 41, - "index": 14601 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayWidth", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayWidth", - "scope": "instance" - } - ], - "namespace": "p5#displayWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayHeight" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen height can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayHeight * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 577, - "column": 0, - "index": 14603 - }, - "end": { - "line": 604, - "column": 3, - "index": 15346 - } - }, - "context": { - "loc": { - "start": { - "line": 605, - "column": 0, - "index": 15347 - }, - "end": { - "line": 605, - "column": 43, - "index": 15390 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayHeight", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayHeight", - "scope": "instance" - } - ], - "namespace": "p5#displayHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 607, - "column": 0, - "index": 15392 - }, - "end": { - "line": 631, - "column": 3, - "index": 16081 - } - }, - "context": { - "loc": { - "start": { - "line": 632, - "column": 0, - "index": 16082 - }, - "end": { - "line": 632, - "column": 44, - "index": 16126 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowWidth", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowWidth", - "scope": "instance" - } - ], - "namespace": "p5#windowWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 634, - "column": 0, - "index": 16128 - }, - "end": { - "line": 658, - "column": 3, - "index": 16819 - } - }, - "context": { - "loc": { - "start": { - "line": 659, - "column": 0, - "index": 16820 - }, - "end": { - "line": 659, - "column": 46, - "index": 16866 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowHeight", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowHeight", - "scope": "instance" - } - ], - "namespace": "p5#windowHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "width" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "width" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 750, - "column": 0, - "index": 19217 - }, - "end": { - "line": 816, - "column": 3, - "index": 20713 - } - }, - "context": { - "loc": { - "start": { - "line": 817, - "column": 0, - "index": 20714 - }, - "end": { - "line": 817, - "column": 23, - "index": 20737 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "width", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "width", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "width", - "scope": "instance" - } - ], - "namespace": "p5#width" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "height" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "height" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 819, - "column": 0, - "index": 20739 - }, - "end": { - "line": 885, - "column": 3, - "index": 22246 - } - }, - "context": { - "loc": { - "start": { - "line": 886, - "column": 0, - "index": 22247 - }, - "end": { - "line": 886, - "column": 24, - "index": 22271 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "height", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "height", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "height", - "scope": "instance" - } - ], - "namespace": "p5#height" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "nothing displayed", - "lineNumber": 20 - } - ], - "loc": { - "start": { - "line": 317, - "column": 4, - "index": 10982 - }, - "end": { - "line": 340, - "column": 7, - "index": 11811 - } - }, - "context": { - "loc": { - "start": { - "line": 341, - "column": 4, - "index": 11816 - }, - "end": { - "line": 402, - "column": 6, - "index": 13726 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "remove", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "remove", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#remove" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function does 3 things:" - } - ] - }, - { - "type": "list", - "ordered": true, - "start": 1, - "spread": true, - "children": [ - { - "type": "listItem", - "spread": true, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Bounds the desired start/stop angles for an arc (in radians) so that:" - } - ] - }, - { - "type": "code", - "lang": null, - "meta": null, - "value": "0 <= start < TWO_PI ; start <= stop < start + TWO_PI" - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This means that the arc rendering functions don't have to be concerned\nwith what happens if stop is smaller than start, or if the arc 'goes\nround more than once', etc.: they can just start at start and increase\nuntil stop and the correct arc will be drawn." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Optionally adjusts the angles within each quadrant to counter the naive\nscaling of the underlying ellipse up from the unit circle. Without\nthis, the angles become arbitrary when width != height: 45 degrees\nmight be drawn at 5 degrees on a 'wide' ellipse, or at 85 degrees on\na 'tall' ellipse." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Flags up when start and stop correspond to the same place on the\nunderlying ellipse. This is useful if you want to do something special\nthere (like rendering a whole ellipse instead)." - } - ] - } - ] - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 16, - "column": 0, - "index": 333 - }, - "end": { - "line": 37, - "column": 3, - "index": 1365 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 1366 - }, - "end": { - "line": 100, - "column": 2, - "index": 3623 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "start", - "lineNumber": 39 - }, - { - "title": "param", - "name": "stop", - "lineNumber": 40 - }, - { - "title": "param", - "name": "width", - "lineNumber": 41 - }, - { - "title": "param", - "name": "height", - "lineNumber": 42 - }, - { - "title": "param", - "name": "correctForScaling", - "lineNumber": 43 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_normalizeArcAngles", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_normalizeArcAngles", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_normalizeArcAngles" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for select and selectAll" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 6392 - }, - "end": { - "line": 193, - "column": 3, - "index": 6443 - } - }, - "context": { - "loc": { - "start": { - "line": 194, - "column": 0, - "index": 6444 - }, - "end": { - "line": 204, - "column": 2, - "index": 6751 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "p", - "lineNumber": 194 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_getContainer", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_getContainer", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_getContainer" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for getElement and getElements." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 206, - "column": 0, - "index": 6753 - }, - "end": { - "line": 208, - "column": 3, - "index": 6811 - } - }, - "context": { - "loc": { - "start": { - "line": 209, - "column": 0, - "index": 6812 - }, - "end": { - "line": 238, - "column": 2, - "index": 7767 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "elt", - "lineNumber": 209 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_wrapElement", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_wrapElement", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_wrapElement" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "INPUT *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 715, - "column": 0, - "index": 21883 - }, - "end": { - "line": 715, - "column": 13, - "index": 21896 - } - }, - "context": { - "loc": { - "start": { - "line": 827, - "column": 0, - "index": 24953 - }, - "end": { - "line": 840, - "column": 2, - "index": 25384 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "min", - "lineNumber": 827 - }, - { - "title": "param", - "name": "max", - "lineNumber": 827 - }, - { - "title": "param", - "name": "value", - "lineNumber": 827 - }, - { - "title": "param", - "name": "step", - "lineNumber": 827 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createSlider", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createSlider", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createSlider" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "AUDIO STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2041, - "column": 0, - "index": 61417 - }, - "end": { - "line": 2041, - "column": 19, - "index": 61436 - } - }, - "context": { - "loc": { - "start": { - "line": 2080, - "column": 0, - "index": 62975 - }, - "end": { - "line": 2083, - "column": 2, - "index": 63135 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "src", - "lineNumber": 2080 - }, - { - "title": "param", - "name": "callback", - "lineNumber": 2080 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createAudio", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createAudio", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createAudio" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "CAMERA STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2085, - "column": 0, - "index": 63137 - }, - "end": { - "line": 2085, - "column": 20, - "index": 63157 - } - }, - "context": { - "loc": { - "start": { - "line": 2087, - "column": 0, - "index": 63159 - }, - "end": { - "line": 2087, - "column": 29, - "index": 63188 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "VIDEO", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "VIDEO", - "scope": "instance" - } - ], - "namespace": "p5#VIDEO" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - }, - "name": "deviceOrientation" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 20, - "column": 3, - "index": 511 - } - }, - "context": { - "loc": { - "start": { - "line": 21, - "column": 0, - "index": 512 - }, - "end": { - "line": 22, - "column": 74, - "index": 619 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deviceOrientation", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deviceOrientation", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deviceOrientation", - "scope": "instance" - } - ], - "namespace": "p5#deviceOrientation" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationX always contains the acceleration of the\ndevice along the x axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 24, - "column": 0, - "index": 621 - }, - "end": { - "line": 43, - "column": 3, - "index": 1167 - } - }, - "context": { - "loc": { - "start": { - "line": 44, - "column": 0, - "index": 1168 - }, - "end": { - "line": 44, - "column": 31, - "index": 1199 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationX", - "scope": "instance" - } - ], - "namespace": "p5#accelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationY always contains the acceleration of the\ndevice along the y axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 46, - "column": 0, - "index": 1201 - }, - "end": { - "line": 65, - "column": 3, - "index": 1746 - } - }, - "context": { - "loc": { - "start": { - "line": 66, - "column": 0, - "index": 1747 - }, - "end": { - "line": 66, - "column": 31, - "index": 1778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationY", - "scope": "instance" - } - ], - "namespace": "p5#accelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationZ always contains the acceleration of the\ndevice along the z axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 68, - "column": 0, - "index": 1780 - }, - "end": { - "line": 88, - "column": 3, - "index": 2328 - } - }, - "context": { - "loc": { - "start": { - "line": 89, - "column": 0, - "index": 2329 - }, - "end": { - "line": 89, - "column": 31, - "index": 2360 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationZ", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#accelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 91, - "column": 0, - "index": 2362 - }, - "end": { - "line": 98, - "column": 3, - "index": 2625 - } - }, - "context": { - "loc": { - "start": { - "line": 99, - "column": 0, - "index": 2626 - }, - "end": { - "line": 99, - "column": 32, - "index": 2658 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationX", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationX", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 101, - "column": 0, - "index": 2660 - }, - "end": { - "line": 108, - "column": 3, - "index": 2923 - } - }, - "context": { - "loc": { - "start": { - "line": 109, - "column": 0, - "index": 2924 - }, - "end": { - "line": 109, - "column": 32, - "index": 2956 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationY", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationY", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 111, - "column": 0, - "index": 2958 - }, - "end": { - "line": 118, - "column": 3, - "index": 3221 - } - }, - "context": { - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 3222 - }, - "end": { - "line": 119, - "column": 32, - "index": 3254 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationZ", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationX always contains the rotation of the\ndevice along the x axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES, the value will be -180 to 180. If\nit is set to RADIANS, the value will be -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 132, - "column": 0, - "index": 3568 - }, - "end": { - "line": 162, - "column": 3, - "index": 4447 - } - }, - "context": { - "loc": { - "start": { - "line": 163, - "column": 0, - "index": 4448 - }, - "end": { - "line": 163, - "column": 27, - "index": 4475 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationX", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationX", - "scope": "instance" - } - ], - "namespace": "p5#rotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationY always contains the rotation of the\ndevice along the y axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 165, - "column": 0, - "index": 4477 - }, - "end": { - "line": 195, - "column": 3, - "index": 5358 - } - }, - "context": { - "loc": { - "start": { - "line": 196, - "column": 0, - "index": 5359 - }, - "end": { - "line": 196, - "column": 27, - "index": 5386 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationY", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationY", - "scope": "instance" - } - ], - "namespace": "p5#rotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationZ always contains the rotation of the\ndevice along the z axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Unlike rotationX and rotationY, this variable is available for devices\nwith a built-in compass only." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - }, - { - "title": "property", - "description": null, - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 33 - } - ], - "loc": { - "start": { - "line": 198, - "column": 0, - "index": 5388 - }, - "end": { - "line": 232, - "column": 3, - "index": 6377 - } - }, - "context": { - "loc": { - "start": { - "line": 233, - "column": 0, - "index": 6378 - }, - "end": { - "line": 233, - "column": 27, - "index": 6405 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationZ", - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationZ", - "scope": "instance" - } - ], - "namespace": "p5#rotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES,\nthe value will be -180 to 180. If it is set to RADIANS, the value will\nbe -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationX can also be used with rotationX to determine the rotate\ndirection of the device along the X-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 40 - } - ], - "loc": { - "start": { - "line": 235, - "column": 0, - "index": 6407 - }, - "end": { - "line": 276, - "column": 3, - "index": 7745 - } - }, - "context": { - "loc": { - "start": { - "line": 277, - "column": 0, - "index": 7746 - }, - "end": { - "line": 277, - "column": 28, - "index": 7774 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationX", - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationX", - "scope": "instance" - } - ], - "namespace": "p5#pRotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationY can also be used with rotationY to determine the rotate\ndirection of the device along the Y-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 39 - } - ], - "loc": { - "start": { - "line": 279, - "column": 0, - "index": 7776 - }, - "end": { - "line": 319, - "column": 3, - "index": 9113 - } - }, - "context": { - "loc": { - "start": { - "line": 320, - "column": 0, - "index": 9114 - }, - "end": { - "line": 320, - "column": 28, - "index": 9142 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationY", - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationY", - "scope": "instance" - } - ], - "namespace": "p5#pRotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationZ can also be used with rotationZ to determine the rotate\ndirection of the device along the Z-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 35 - } - ], - "loc": { - "start": { - "line": 322, - "column": 0, - "index": 9144 - }, - "end": { - "line": 358, - "column": 3, - "index": 10350 - } - }, - "context": { - "loc": { - "start": { - "line": 359, - "column": 0, - "index": 10351 - }, - "end": { - "line": 359, - "column": 28, - "index": 10379 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationZ", - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationZ", - "scope": "instance" - } - ], - "namespace": "p5#pRotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When a device is rotated, the axis that triggers the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "deviceTurned()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nmethod is stored in the turnAxis variable. The turnAxis variable is only defined within\nthe scope of deviceTurned()." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "turnAxis" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 379, - "column": 0, - "index": 10890 - }, - "end": { - "line": 412, - "column": 3, - "index": 11826 - } - }, - "context": { - "loc": { - "start": { - "line": 413, - "column": 0, - "index": 11827 - }, - "end": { - "line": 413, - "column": 34, - "index": 11861 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "turnAxis", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "turnAxis", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "turnAxis", - "scope": "instance" - } - ], - "namespace": "p5#turnAxis" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyIsPressed" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is true if any key is pressed\nand false if no keys are pressed." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "keyIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 111 - }, - "end": { - "line": 30, - "column": 3, - "index": 575 - } - }, - "context": { - "loc": { - "start": { - "line": 31, - "column": 0, - "index": 576 - }, - "end": { - "line": 31, - "column": 34, - "index": 610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "isKeyPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "isKeyPressed", - "scope": "instance" - } - ], - "namespace": "p5#isKeyPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyTyped()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". For non-ASCII keys, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyCode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nvariable." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "key" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 34, - "column": 0, - "index": 655 - }, - "end": { - "line": 57, - "column": 3, - "index": 1373 - } - }, - "context": { - "loc": { - "start": { - "line": 58, - "column": 0, - "index": 1374 - }, - "end": { - "line": 58, - "column": 22, - "index": 1396 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "key", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "key", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "key", - "scope": "instance" - } - ], - "namespace": "p5#key" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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: " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keycode.info" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "keyCode" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 60, - "column": 0, - "index": 1398 - }, - "end": { - "line": 95, - "column": 3, - "index": 2425 - } - }, - "context": { - "loc": { - "start": { - "line": 96, - "column": 0, - "index": 2426 - }, - "end": { - "line": 96, - "column": 25, - "index": 2451 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyCode", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "keyCode", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "keyCode", - "scope": "instance" - } - ], - "namespace": "p5#keyCode" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The onblur function is called when the user is no longer focused\non the p5 element. Because the keyup events will not fire if the user is\nnot focused on the element we must assume all keys currently down have\nbeen released." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 291, - "column": 0, - "index": 8735 - }, - "end": { - "line": 296, - "column": 3, - "index": 8978 - } - }, - "context": { - "loc": { - "start": { - "line": 297, - "column": 0, - "index": 8979 - }, - "end": { - "line": 299, - "column": 2, - "index": 9041 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "e", - "lineNumber": 297 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_onblur", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_onblur", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_onblur" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedX contains the horizontal movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 4 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 40, - "column": 3, - "index": 777 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 778 - }, - "end": { - "line": 41, - "column": 24, - "index": 802 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedX", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedX", - "scope": "instance" - } - ], - "namespace": "p5#movedX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedY contains the vertical movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 43, - "column": 0, - "index": 804 - }, - "end": { - "line": 70, - "column": 3, - "index": 1394 - } - }, - "context": { - "loc": { - "start": { - "line": 71, - "column": 0, - "index": 1395 - }, - "end": { - "line": 71, - "column": 24, - "index": 1419 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedY", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedY", - "scope": "instance" - } - ], - "namespace": "p5#movedY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 80, - "column": 0, - "index": 1666 - }, - "end": { - "line": 101, - "column": 3, - "index": 2316 - } - }, - "context": { - "loc": { - "start": { - "line": 102, - "column": 0, - "index": 2317 - }, - "end": { - "line": 102, - "column": 24, - "index": 2341 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseX", - "scope": "instance" - } - ], - "namespace": "p5#mouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 2343 - }, - "end": { - "line": 125, - "column": 3, - "index": 2986 - } - }, - "context": { - "loc": { - "start": { - "line": 126, - "column": 0, - "index": 2987 - }, - "end": { - "line": 126, - "column": 24, - "index": 3011 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseY", - "scope": "instance" - } - ], - "namespace": "p5#mouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 128, - "column": 0, - "index": 3013 - }, - "end": { - "line": 156, - "column": 3, - "index": 3890 - } - }, - "context": { - "loc": { - "start": { - "line": 157, - "column": 0, - "index": 3891 - }, - "end": { - "line": 157, - "column": 25, - "index": 3916 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseX", - "scope": "instance" - } - ], - "namespace": "p5#pmouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 159, - "column": 0, - "index": 3918 - }, - "end": { - "line": 186, - "column": 3, - "index": 4745 - } - }, - "context": { - "loc": { - "start": { - "line": 187, - "column": 0, - "index": 4746 - }, - "end": { - "line": 187, - "column": 25, - "index": 4771 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseY", - "scope": "instance" - } - ], - "namespace": "p5#pmouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseX always contains the current horizontal\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 189, - "column": 0, - "index": 4773 - }, - "end": { - "line": 223, - "column": 3, - "index": 5653 - } - }, - "context": { - "loc": { - "start": { - "line": 224, - "column": 0, - "index": 5654 - }, - "end": { - "line": 224, - "column": 27, - "index": 5681 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseX", - "scope": "instance" - } - ], - "namespace": "p5#winMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseY always contains the current vertical\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 226, - "column": 0, - "index": 5683 - }, - "end": { - "line": 260, - "column": 3, - "index": 6560 - } - }, - "context": { - "loc": { - "start": { - "line": 261, - "column": 0, - "index": 6561 - }, - "end": { - "line": 261, - "column": 27, - "index": 6588 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseY", - "scope": "instance" - } - ], - "namespace": "p5#winMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 263, - "column": 0, - "index": 6590 - }, - "end": { - "line": 299, - "column": 3, - "index": 7675 - } - }, - "context": { - "loc": { - "start": { - "line": 300, - "column": 0, - "index": 7676 - }, - "end": { - "line": 300, - "column": 28, - "index": 7704 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseX", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseX", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 302, - "column": 0, - "index": 7706 - }, - "end": { - "line": 338, - "column": 3, - "index": 8785 - } - }, - "context": { - "loc": { - "start": { - "line": 339, - "column": 0, - "index": 8786 - }, - "end": { - "line": 339, - "column": 28, - "index": 8814 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseY", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseY", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - }, - "name": "mouseButton" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 341, - "column": 0, - "index": 8816 - }, - "end": { - "line": 375, - "column": 3, - "index": 9715 - } - }, - "context": { - "loc": { - "start": { - "line": 376, - "column": 0, - "index": 9716 - }, - "end": { - "line": 376, - "column": 29, - "index": 9745 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseButton", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseButton", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseButton", - "scope": "instance" - } - ], - "namespace": "p5#mouseButton" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable mouseIsPressed is true if the mouse is pressed\nand false if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "mouseIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 378, - "column": 0, - "index": 9747 - }, - "end": { - "line": 404, - "column": 3, - "index": 10289 - } - }, - "context": { - "loc": { - "start": { - "line": 405, - "column": 0, - "index": 10290 - }, - "end": { - "line": 405, - "column": 36, - "index": 10326 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseIsPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseIsPressed", - "scope": "instance" - } - ], - "namespace": "p5#mouseIsPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The touches[] array is not supported on Safari and IE on touch-based\ndesktops (laptops)." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - }, - "name": "touches" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 108 - }, - "end": { - "line": 37, - "column": 3, - "index": 883 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 884 - }, - "end": { - "line": 38, - "column": 26, - "index": 910 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/touch.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "touches", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "touches", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "touches", - "scope": "instance" - } - ], - "namespace": "p5#touches" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An array containing the color of each pixel on the canvas. Colors are\nstored as numbers representing red, green, blue, and alpha (RGBA) values.\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " is a one-dimensional array for performance reasons." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Each pixel occupies four elements in the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array, one for each RGBA\nvalue. For example, the pixel at coordinates (0, 0) stores its RGBA values\nat " - }, - { - "type": "inlineCode", - "value": "pixels[0]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[1]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[2]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[3]" - }, - { - "type": "text", - "value": ", respectively.\nThe next pixel at coordinates (1, 0) stores its RGBA values at " - }, - { - "type": "inlineCode", - "value": "pixels[4]" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "inlineCode", - "value": "pixels[5]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[6]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[7]" - }, - { - "type": "text", - "value": ". And so on. The " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array\nfor a 100×100 canvas has 100 × 100 × 4 = 40,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Some displays use several smaller pixels to set the color at a single\npoint. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function returns\nthe pixel density of the canvas. High density displays often have a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " of 2. On such a display, the\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array for a 100×100 canvas has 200 × 200 × 4 =\n160,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Accessing the RGBA values for a point on the canvas requires a little math\nas shown below. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadPixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function\nmust be called before accessing the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array. The\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "updatePixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function must be called\nafter any changes are made." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "pixels" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 169 - }, - "end": { - "line": 103, - "column": 3, - "index": 3031 - } - }, - "context": { - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 3032 - }, - "end": { - "line": 104, - "column": 25, - "index": 3057 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pixels", - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pixels", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pixels", - "scope": "instance" - } - ], - "namespace": "p5#pixels" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function to measure ascent and descent." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 362, - "column": 0, - "index": 9474 - }, - "end": { - "line": 364, - "column": 3, - "index": 9531 - } - }, - "context": { - "loc": { - "start": { - "line": 365, - "column": 0, - "index": 9532 - }, - "end": { - "line": 367, - "column": 2, - "index": 9627 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_updateTextMetrics", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_updateTextMetrics", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_updateTextMetrics" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ensures that p5 is using a 3d renderer. throws an error if not." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2350, - "column": 0, - "index": 73393 - }, - "end": { - "line": 2352, - "column": 3, - "index": 73467 - } - }, - "context": { - "loc": { - "start": { - "line": 2353, - "column": 0, - "index": 73468 - }, - "end": { - "line": 2358, - "column": 2, - "index": 73742 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "name", - "lineNumber": 2353 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_assert3d", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_assert3d", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_assert3d" - } - ], - "events": [], - "static": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Turn off some features of the friendly error system (FES), which can give\na significant boost to performance when needed." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ndisabling the friendly error system" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "disableFriendlyErrors" - }, - { - "title": "example", - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 754, - "column": 0, - "index": 26038 - }, - "end": { - "line": 776, - "column": 3, - "index": 26889 - } - }, - "context": { - "loc": { - "start": { - "line": 777, - "column": 0, - "index": 26890 - }, - "end": { - "line": 777, - "column": 33, - "index": 26923 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "disableFriendlyErrors", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "disableFriendlyErrors", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "disableFriendlyErrors", - "scope": "static" - } - ], - "namespace": "p5.disableFriendlyErrors" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Path to the media element's source as a string." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.MediaElement", - "lineNumber": 3 - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "src" - }, - { - "title": "return", - "description": "src", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 4842, - "column": 0, - "index": 139686 - }, - "end": { - "line": 4868, - "column": 3, - "index": 140231 - } - }, - "context": { - "loc": { - "start": { - "line": 4958, - "column": 0, - "index": 142394 - }, - "end": { - "line": 5009, - "column": 2, - "index": 143967 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "src" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "File", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "File", - "scope": "static" - } - ], - "namespace": "p5.File" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Table Options\nGeneric class for handling tabular data, typically from a\nCSV, TSV, or other sort of spreadsheet file.\nCSV files are\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ncomma separated values" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", often with the data in quotes. TSV\nfiles use tabs as separators, and usually don't bother with the\nquotes.\nFile names should end with .csv if they're comma separated.\nA rough \"spec\" for CSV can be found\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "here" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nTo load files, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method.\nTo save tables to your computer, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "save" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method\nor the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "saveTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Possible options include:" - } - ] - }, - { - "type": "html", - "value": "
    \n
  • csv - parse the table as comma-separated values\n
  • tsv - parse the table as tab-separated values\n
  • header - this table has a header (title) row\n
" - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 93 - }, - "end": { - "line": 31, - "column": 3, - "index": 1053 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 1379 - }, - "end": { - "line": 1259, - "column": 2, - "index": 33791 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "Table", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addRow()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new row of data to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "set()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object is included as a parameter, then that row is\nduplicated and added to the table." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row to be added to the table", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - "name": "row" - }, - { - "title": "return", - "description": "the row that was added", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 47, - "column": 2, - "index": 1476 - }, - "end": { - "line": 94, - "column": 3, - "index": 2995 - } - }, - "context": { - "loc": { - "start": { - "line": 95, - "column": 2, - "index": 2998 - }, - "end": { - "line": 106, - "column": 3, - "index": 3319 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row to be added to the table" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the row that was added" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes a row from the table object." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to remove", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "id" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 108, - "column": 2, - "index": 3323 - }, - "end": { - "line": 145, - "column": 3, - "index": 4202 - } - }, - "context": { - "loc": { - "start": { - "line": 146, - "column": 2, - "index": 4205 - }, - "end": { - "line": 151, - "column": 3, - "index": 4410 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "id", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to remove" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a reference to the specified " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". The reference\ncan then be used to get and set values of the selected row." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to get", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "rowID" - }, - { - "title": "return", - "description": "p5.TableRow object", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 153, - "column": 2, - "index": 4414 - }, - "end": { - "line": 191, - "column": 3, - "index": 5463 - } - }, - "context": { - "loc": { - "start": { - "line": 192, - "column": 2, - "index": 5466 - }, - "end": { - "line": 194, - "column": 3, - "index": 5507 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "r", - "lineNumber": 192 - }, - { - "title": "param", - "name": "rowID", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to get" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Gets all rows from the table. Returns an array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Array of p5.TableRows", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 196, - "column": 2, - "index": 5511 - }, - "end": { - "line": 237, - "column": 3, - "index": 6588 - } - }, - "context": { - "loc": { - "start": { - "line": 238, - "column": 2, - "index": 6591 - }, - "end": { - "line": 240, - "column": 3, - "index": 6629 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 242, - "column": 2, - "index": 6633 - }, - "end": { - "line": 282, - "column": 3, - "index": 7805 - } - }, - "context": { - "loc": { - "start": { - "line": 283, - "column": 2, - "index": 7808 - }, - "end": { - "line": 301, - "column": 3, - "index": 8272 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 10, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 303, - "column": 2, - "index": 8276 - }, - "end": { - "line": 348, - "column": 3, - "index": 9683 - } - }, - "context": { - "loc": { - "start": { - "line": 349, - "column": 2, - "index": 9686 - }, - "end": { - "line": 366, - "column": 3, - "index": 10136 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "TableRow object", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 368, - "column": 2, - "index": 10140 - }, - "end": { - "line": 407, - "column": 3, - "index": 11362 - } - }, - "context": { - "loc": { - "start": { - "line": 408, - "column": 2, - "index": 11365 - }, - "end": { - "line": 423, - "column": 3, - "index": 11778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "TableRow object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 425, - "column": 2, - "index": 11782 - }, - "end": { - "line": 472, - "column": 3, - "index": 13226 - } - }, - "context": { - "loc": { - "start": { - "line": 473, - "column": 2, - "index": 13229 - }, - "end": { - "line": 489, - "column": 3, - "index": 13668 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all values in the specified column, and returns them\nas an array. The column may be specified by either its ID or title." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String or Number of the column to return", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "Array of column values", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 491, - "column": 2, - "index": 13672 - }, - "end": { - "line": 525, - "column": 3, - "index": 14658 - } - }, - "context": { - "loc": { - "start": { - "line": 526, - "column": 2, - "index": 14661 - }, - "end": { - "line": 538, - "column": 3, - "index": 14980 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 526 - }, - { - "title": "param", - "name": "column", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String or Number of the column to return" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of column values" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes all rows from a Table. While all rows are removed,\ncolumns and column titles are maintained." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 540, - "column": 2, - "index": 14984 - }, - "end": { - "line": 571, - "column": 3, - "index": 15789 - } - }, - "context": { - "loc": { - "start": { - "line": 572, - "column": 2, - "index": 15792 - }, - "end": { - "line": 575, - "column": 3, - "index": 15852 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clearRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "clearRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#clearRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new column to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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.)" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "title of the given column", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "title" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 577, - "column": 2, - "index": 15856 - }, - "end": { - "line": 619, - "column": 3, - "index": 17079 - } - }, - "context": { - "loc": { - "start": { - "line": 620, - "column": 2, - "index": 17082 - }, - "end": { - "line": 623, - "column": 3, - "index": 17160 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "title", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "title of the given column" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of columns in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of columns in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 625, - "column": 2, - "index": 17164 - }, - "end": { - "line": 655, - "column": 3, - "index": 17854 - } - }, - "context": { - "loc": { - "start": { - "line": 656, - "column": 2, - "index": 17857 - }, - "end": { - "line": 658, - "column": 3, - "index": 17912 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of columns in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumnCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumnCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumnCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of rows in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of rows in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 660, - "column": 2, - "index": 17916 - }, - "end": { - "line": 690, - "column": 3, - "index": 18564 - } - }, - "context": { - "loc": { - "start": { - "line": 691, - "column": 2, - "index": 18567 - }, - "end": { - "line": 693, - "column": 3, - "index": 18616 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of rows in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRowCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRowCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRowCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes any of the specified characters (or \"tokens\")." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String listing characters to be removed", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "chars" - }, - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 695, - "column": 2, - "index": 18620 - }, - "end": { - "line": 730, - "column": 3, - "index": 19601 - } - }, - "context": { - "loc": { - "start": { - "line": 731, - "column": 2, - "index": 19604 - }, - "end": { - "line": 764, - "column": 3, - "index": 20779 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "chars", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String listing characters to be removed" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeTokens", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeTokens", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeTokens" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 766, - "column": 2, - "index": 20783 - }, - "end": { - "line": 798, - "column": 3, - "index": 21711 - } - }, - "context": { - "loc": { - "start": { - "line": 799, - "column": 2, - "index": 21714 - }, - "end": { - "line": 827, - "column": 3, - "index": 22666 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "trim", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "trim", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#trim" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "removeColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "columnName (string) or ID (number)", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 829, - "column": 2, - "index": 22670 - }, - "end": { - "line": 864, - "column": 3, - "index": 23691 - } - }, - "context": { - "loc": { - "start": { - "line": 865, - "column": 2, - "index": 23694 - }, - "end": { - "line": 888, - "column": 3, - "index": 24362 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "c", - "lineNumber": 865 - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or ID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 890, - "column": 2, - "index": 24366 - }, - "end": { - "line": 932, - "column": 3, - "index": 25518 - } - }, - "context": { - "loc": { - "start": { - "line": 933, - "column": 2, - "index": 25521 - }, - "end": { - "line": 935, - "column": 3, - "index": 25590 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "set", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "set", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#set" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 937, - "column": 2, - "index": 25594 - }, - "end": { - "line": 976, - "column": 3, - "index": 26578 - } - }, - "context": { - "loc": { - "start": { - "line": 977, - "column": 2, - "index": 26581 - }, - "end": { - "line": 979, - "column": 3, - "index": 26656 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 981, - "column": 2, - "index": 26660 - }, - "end": { - "line": 1019, - "column": 3, - "index": 27767 - } - }, - "context": { - "loc": { - "start": { - "line": 1020, - "column": 2, - "index": 27770 - }, - "end": { - "line": 1022, - "column": 3, - "index": 27851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1024, - "column": 2, - "index": 27855 - }, - "end": { - "line": 1062, - "column": 3, - "index": 28842 - } - }, - "context": { - "loc": { - "start": { - "line": 1063, - "column": 2, - "index": 28845 - }, - "end": { - "line": 1065, - "column": 3, - "index": 28907 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "get", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "get", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#get" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1067, - "column": 2, - "index": 28911 - }, - "end": { - "line": 1103, - "column": 3, - "index": 29853 - } - }, - "context": { - "loc": { - "start": { - "line": 1104, - "column": 2, - "index": 29856 - }, - "end": { - "line": 1106, - "column": 3, - "index": 29924 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1108, - "column": 2, - "index": 29928 - }, - "end": { - "line": 1151, - "column": 3, - "index": 31214 - } - }, - "context": { - "loc": { - "start": { - "line": 1153, - "column": 2, - "index": 31218 - }, - "end": { - "line": 1155, - "column": 3, - "index": 31292 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Name of the column which should be used to\n title each row object (optional)", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "headerColumn" - }, - { - "title": "return", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 1157, - "column": 2, - "index": 31296 - }, - "end": { - "line": 1195, - "column": 3, - "index": 32265 - } - }, - "context": { - "loc": { - "start": { - "line": 1196, - "column": 2, - "index": 32268 - }, - "end": { - "line": 1216, - "column": 3, - "index": 32851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "headerColumn", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Name of the column which should be used to\ntitle each row object (optional)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getObject", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getObject", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getObject" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all table data and returns it as a multidimensional array." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 1218, - "column": 2, - "index": 32855 - }, - "end": { - "line": 1251, - "column": 3, - "index": 33622 - } - }, - "context": { - "loc": { - "start": { - "line": 1252, - "column": 2, - "index": 33625 - }, - "end": { - "line": 1258, - "column": 3, - "index": 33788 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getArray", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getArray" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - } - ], - "namespace": "p5.Table" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An internal class to store data that will be sent to a p5.RenderBuffer.\nThose need to eventually go into a Float32Array, so this class provides a\nvariable-length array container backed by a Float32Array so that it can be\nsent to the GPU without allocating a new array each frame." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Like a C++ vector, its fixed-length Float32Array backing its contents will\ndouble in size when it goes over its capacity." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 3, - "column": 0, - "index": 32 - }, - "end": { - "line": 27, - "column": 3, - "index": 926 - } - }, - "context": { - "loc": { - "start": { - "line": 28, - "column": 0, - "index": 927 - }, - "end": { - "line": 108, - "column": 2, - "index": 2998 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "DataArray", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a Float32Array window sized to the exact length of the data" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 35, - "column": 2, - "index": 1114 - }, - "end": { - "line": 37, - "column": 5, - "index": 1196 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 2, - "index": 1199 - }, - "end": { - "line": 40, - "column": 3, - "index": 1258 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dataArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "dataArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#dataArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A \"soft\" clear, which keeps the underlying storage size the same, but\nempties the contents of its dataArray()" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 42, - "column": 2, - "index": 1262 - }, - "end": { - "line": 45, - "column": 5, - "index": 1391 - } - }, - "context": { - "loc": { - "start": { - "line": 46, - "column": 2, - "index": 1394 - }, - "end": { - "line": 48, - "column": 3, - "index": 1428 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clear", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "clear", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#clear" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Can be used to scale a DataArray back down to fit its contents." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 50, - "column": 2, - "index": 1432 - }, - "end": { - "line": 52, - "column": 5, - "index": 1510 - } - }, - "context": { - "loc": { - "start": { - "line": 53, - "column": 2, - "index": 1513 - }, - "end": { - "line": 61, - "column": 3, - "index": 1839 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rescale", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "rescale", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#rescale" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A full reset, which allocates a new underlying Float32Array at its initial\nlength" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 63, - "column": 2, - "index": 1843 - }, - "end": { - "line": 66, - "column": 5, - "index": 1944 - } - }, - "context": { - "loc": { - "start": { - "line": 67, - "column": 2, - "index": 1947 - }, - "end": { - "line": 70, - "column": 3, - "index": 2032 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "reset", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "reset", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#reset" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Adds values to the DataArray, expanding its internal storage to\naccommodate the new items." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 72, - "column": 2, - "index": 2036 - }, - "end": { - "line": 75, - "column": 5, - "index": 2146 - } - }, - "context": { - "loc": { - "start": { - "line": 76, - "column": 2, - "index": 2149 - }, - "end": { - "line": 80, - "column": 3, - "index": 2296 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "values", - "lineNumber": 76, - "type": { - "type": "RestType" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "push", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "push", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#push" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a copy of the data from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to the index\n" - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 82, - "column": 2, - "index": 2300 - }, - "end": { - "line": 85, - "column": 5, - "index": 2409 - } - }, - "context": { - "loc": { - "start": { - "line": 86, - "column": 2, - "index": 2412 - }, - "end": { - "line": 88, - "column": 3, - "index": 2494 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 86 - }, - { - "title": "param", - "name": "to", - "lineNumber": 86 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "slice", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "slice", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#slice" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a mutable Float32Array window from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to\nthe index " - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 90, - "column": 2, - "index": 2498 - }, - "end": { - "line": 93, - "column": 5, - "index": 2618 - } - }, - "context": { - "loc": { - "start": { - "line": 94, - "column": 2, - "index": 2621 - }, - "end": { - "line": 96, - "column": 3, - "index": 2709 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 94 - }, - { - "title": "param", - "name": "to", - "lineNumber": 94 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "subArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "subArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#subArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Expand capacity of the internal storage until it can fit a target size" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 98, - "column": 2, - "index": 2713 - }, - "end": { - "line": 100, - "column": 5, - "index": 2798 - } - }, - "context": { - "loc": { - "start": { - "line": 101, - "column": 2, - "index": 2801 - }, - "end": { - "line": 107, - "column": 3, - "index": 2995 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "target", - "lineNumber": 101 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "ensureLength", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "ensureLength", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#ensureLength" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - } - ], - "namespace": "p5.DataArray" - } - ] - }, - "path": [ - { - "name": "p5" - } - ], - "namespace": "p5" - }, - { - "description": "", - "tags": [ - { - "title": "requires", - "description": null, - "lineNumber": 1, - "name": "constants" - }, - { - "title": "todo", - "description": "see methods below needing further implementation.\nfuture consideration: implement SIMD optimizations\nwhen browser compatibility becomes available\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/\n Reference/Global_Objects/SIMD", - "lineNumber": 2 - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 8, - "column": 3, - "index": 286 - } - }, - "context": { - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 288 - }, - "end": { - "line": 10, - "column": 30, - "index": 318 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [ - { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "see methods below needing further implementation.\nfuture consideration: implement SIMD optimizations\nwhen browser compatibility becomes available\n" - }, - { - "type": "link", - "title": null, - "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/", - "children": [ - { - "type": "text", - "value": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/" - } - ] - }, - { - "type": "text", - "value": "\nReference/Global_Objects/SIMD" - } - ] - } - ] - } - ], - "yields": [], - "name": "p5", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the number of frames drawn since the sketch started." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "frameCount" - }, - { - "type": "text", - "value": "'s value is 0 inside " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". It\nincrements by 1 each time the code in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfinishes executing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "frameCount" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 69, - "column": 0, - "index": 1553 - }, - "end": { - "line": 116, - "column": 3, - "index": 2581 - } - }, - "context": { - "loc": { - "start": { - "line": 117, - "column": 0, - "index": 2582 - }, - "end": { - "line": 117, - "column": 28, - "index": 2610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "frameCount", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "frameCount", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "frameCount", - "scope": "instance" - } - ], - "namespace": "p5#frameCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the amount of time, in milliseconds, it took for\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to draw the previous frame. " - }, - { - "type": "inlineCode", - "value": "deltaTime" - }, - { - "type": "text", - "value": " is\nuseful for simulating physics." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "deltaTime" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 2612 - }, - "end": { - "line": 161, - "column": 3, - "index": 3539 - } - }, - "context": { - "loc": { - "start": { - "line": 162, - "column": 0, - "index": 3540 - }, - "end": { - "line": 162, - "column": 27, - "index": 3567 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deltaTime", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deltaTime", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deltaTime", - "scope": "instance" - } - ], - "namespace": "p5#deltaTime" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks whether the browser window is focused and can receive user input.\n" - }, - { - "type": "inlineCode", - "value": "focused" - }, - { - "type": "text", - "value": " is " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": " if the window if focused and " - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "focused" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 164, - "column": 0, - "index": 3569 - }, - "end": { - "line": 190, - "column": 3, - "index": 4257 - } - }, - "context": { - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 4258 - }, - "end": { - "line": 191, - "column": 43, - "index": 4301 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "focused", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "focused", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "focused", - "scope": "instance" - } - ], - "namespace": "p5#focused" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A string variable with the WebGL version in use. Its value equals one of\nthe followin string constants:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL2" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl2'" - }, - { - "type": "text", - "value": "," - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl'" - }, - { - "type": "text", - "value": ", or" - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "P2D" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'p2d'" - }, - { - "type": "text", - "value": ". This is the default for 2D sketches." - } - ] - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setAttributes()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for ways to set the\nWebGL version." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - }, - "name": "webglVersion" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 12 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 466, - "column": 0, - "index": 12055 - }, - "end": { - "line": 544, - "column": 3, - "index": 13784 - } - }, - "context": { - "loc": { - "start": { - "line": 545, - "column": 0, - "index": 13785 - }, - "end": { - "line": 545, - "column": 34, - "index": 13819 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "webglVersion", - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "webglVersion", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "webglVersion", - "scope": "instance" - } - ], - "namespace": "p5#webglVersion" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayWidth" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen width can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayWidth * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 547, - "column": 0, - "index": 13821 - }, - "end": { - "line": 574, - "column": 3, - "index": 14559 - } - }, - "context": { - "loc": { - "start": { - "line": 575, - "column": 0, - "index": 14560 - }, - "end": { - "line": 575, - "column": 41, - "index": 14601 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayWidth", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayWidth", - "scope": "instance" - } - ], - "namespace": "p5#displayWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayHeight" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen height can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayHeight * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 577, - "column": 0, - "index": 14603 - }, - "end": { - "line": 604, - "column": 3, - "index": 15346 - } - }, - "context": { - "loc": { - "start": { - "line": 605, - "column": 0, - "index": 15347 - }, - "end": { - "line": 605, - "column": 43, - "index": 15390 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayHeight", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayHeight", - "scope": "instance" - } - ], - "namespace": "p5#displayHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 607, - "column": 0, - "index": 15392 - }, - "end": { - "line": 631, - "column": 3, - "index": 16081 - } - }, - "context": { - "loc": { - "start": { - "line": 632, - "column": 0, - "index": 16082 - }, - "end": { - "line": 632, - "column": 44, - "index": 16126 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowWidth", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowWidth", - "scope": "instance" - } - ], - "namespace": "p5#windowWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 634, - "column": 0, - "index": 16128 - }, - "end": { - "line": 658, - "column": 3, - "index": 16819 - } - }, - "context": { - "loc": { - "start": { - "line": 659, - "column": 0, - "index": 16820 - }, - "end": { - "line": 659, - "column": 46, - "index": 16866 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowHeight", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowHeight", - "scope": "instance" - } - ], - "namespace": "p5#windowHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "width" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "width" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 750, - "column": 0, - "index": 19217 - }, - "end": { - "line": 816, - "column": 3, - "index": 20713 - } - }, - "context": { - "loc": { - "start": { - "line": 817, - "column": 0, - "index": 20714 - }, - "end": { - "line": 817, - "column": 23, - "index": 20737 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "width", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "width", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "width", - "scope": "instance" - } - ], - "namespace": "p5#width" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "height" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "height" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 819, - "column": 0, - "index": 20739 - }, - "end": { - "line": 885, - "column": 3, - "index": 22246 - } - }, - "context": { - "loc": { - "start": { - "line": 886, - "column": 0, - "index": 22247 - }, - "end": { - "line": 886, - "column": 24, - "index": 22271 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "height", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "height", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "height", - "scope": "instance" - } - ], - "namespace": "p5#height" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "nothing displayed", - "lineNumber": 20 - } - ], - "loc": { - "start": { - "line": 317, - "column": 4, - "index": 10982 - }, - "end": { - "line": 340, - "column": 7, - "index": 11811 - } - }, - "context": { - "loc": { - "start": { - "line": 341, - "column": 4, - "index": 11816 - }, - "end": { - "line": 402, - "column": 6, - "index": 13726 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "remove", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "remove", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#remove" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function does 3 things:" - } - ] - }, - { - "type": "list", - "ordered": true, - "start": 1, - "spread": true, - "children": [ - { - "type": "listItem", - "spread": true, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Bounds the desired start/stop angles for an arc (in radians) so that:" - } - ] - }, - { - "type": "code", - "lang": null, - "meta": null, - "value": "0 <= start < TWO_PI ; start <= stop < start + TWO_PI" - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This means that the arc rendering functions don't have to be concerned\nwith what happens if stop is smaller than start, or if the arc 'goes\nround more than once', etc.: they can just start at start and increase\nuntil stop and the correct arc will be drawn." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Optionally adjusts the angles within each quadrant to counter the naive\nscaling of the underlying ellipse up from the unit circle. Without\nthis, the angles become arbitrary when width != height: 45 degrees\nmight be drawn at 5 degrees on a 'wide' ellipse, or at 85 degrees on\na 'tall' ellipse." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Flags up when start and stop correspond to the same place on the\nunderlying ellipse. This is useful if you want to do something special\nthere (like rendering a whole ellipse instead)." - } - ] - } - ] - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 16, - "column": 0, - "index": 333 - }, - "end": { - "line": 37, - "column": 3, - "index": 1365 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 1366 - }, - "end": { - "line": 100, - "column": 2, - "index": 3623 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "start", - "lineNumber": 39 - }, - { - "title": "param", - "name": "stop", - "lineNumber": 40 - }, - { - "title": "param", - "name": "width", - "lineNumber": 41 - }, - { - "title": "param", - "name": "height", - "lineNumber": 42 - }, - { - "title": "param", - "name": "correctForScaling", - "lineNumber": 43 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_normalizeArcAngles", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_normalizeArcAngles", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_normalizeArcAngles" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for select and selectAll" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 6392 - }, - "end": { - "line": 193, - "column": 3, - "index": 6443 - } - }, - "context": { - "loc": { - "start": { - "line": 194, - "column": 0, - "index": 6444 - }, - "end": { - "line": 204, - "column": 2, - "index": 6751 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "p", - "lineNumber": 194 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_getContainer", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_getContainer", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_getContainer" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for getElement and getElements." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 206, - "column": 0, - "index": 6753 - }, - "end": { - "line": 208, - "column": 3, - "index": 6811 - } - }, - "context": { - "loc": { - "start": { - "line": 209, - "column": 0, - "index": 6812 - }, - "end": { - "line": 238, - "column": 2, - "index": 7767 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "elt", - "lineNumber": 209 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_wrapElement", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_wrapElement", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_wrapElement" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "INPUT *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 715, - "column": 0, - "index": 21883 - }, - "end": { - "line": 715, - "column": 13, - "index": 21896 - } - }, - "context": { - "loc": { - "start": { - "line": 827, - "column": 0, - "index": 24953 - }, - "end": { - "line": 840, - "column": 2, - "index": 25384 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "min", - "lineNumber": 827 - }, - { - "title": "param", - "name": "max", - "lineNumber": 827 - }, - { - "title": "param", - "name": "value", - "lineNumber": 827 - }, - { - "title": "param", - "name": "step", - "lineNumber": 827 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createSlider", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createSlider", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createSlider" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "AUDIO STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2041, - "column": 0, - "index": 61417 - }, - "end": { - "line": 2041, - "column": 19, - "index": 61436 - } - }, - "context": { - "loc": { - "start": { - "line": 2080, - "column": 0, - "index": 62975 - }, - "end": { - "line": 2083, - "column": 2, - "index": 63135 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "src", - "lineNumber": 2080 - }, - { - "title": "param", - "name": "callback", - "lineNumber": 2080 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createAudio", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createAudio", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createAudio" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "CAMERA STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2085, - "column": 0, - "index": 63137 - }, - "end": { - "line": 2085, - "column": 20, - "index": 63157 - } - }, - "context": { - "loc": { - "start": { - "line": 2087, - "column": 0, - "index": 63159 - }, - "end": { - "line": 2087, - "column": 29, - "index": 63188 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "VIDEO", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "VIDEO", - "scope": "instance" - } - ], - "namespace": "p5#VIDEO" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - }, - "name": "deviceOrientation" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 20, - "column": 3, - "index": 511 - } - }, - "context": { - "loc": { - "start": { - "line": 21, - "column": 0, - "index": 512 - }, - "end": { - "line": 22, - "column": 74, - "index": 619 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deviceOrientation", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deviceOrientation", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deviceOrientation", - "scope": "instance" - } - ], - "namespace": "p5#deviceOrientation" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationX always contains the acceleration of the\ndevice along the x axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 24, - "column": 0, - "index": 621 - }, - "end": { - "line": 43, - "column": 3, - "index": 1167 - } - }, - "context": { - "loc": { - "start": { - "line": 44, - "column": 0, - "index": 1168 - }, - "end": { - "line": 44, - "column": 31, - "index": 1199 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationX", - "scope": "instance" - } - ], - "namespace": "p5#accelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationY always contains the acceleration of the\ndevice along the y axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 46, - "column": 0, - "index": 1201 - }, - "end": { - "line": 65, - "column": 3, - "index": 1746 - } - }, - "context": { - "loc": { - "start": { - "line": 66, - "column": 0, - "index": 1747 - }, - "end": { - "line": 66, - "column": 31, - "index": 1778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationY", - "scope": "instance" - } - ], - "namespace": "p5#accelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationZ always contains the acceleration of the\ndevice along the z axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 68, - "column": 0, - "index": 1780 - }, - "end": { - "line": 88, - "column": 3, - "index": 2328 - } - }, - "context": { - "loc": { - "start": { - "line": 89, - "column": 0, - "index": 2329 - }, - "end": { - "line": 89, - "column": 31, - "index": 2360 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationZ", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#accelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 91, - "column": 0, - "index": 2362 - }, - "end": { - "line": 98, - "column": 3, - "index": 2625 - } - }, - "context": { - "loc": { - "start": { - "line": 99, - "column": 0, - "index": 2626 - }, - "end": { - "line": 99, - "column": 32, - "index": 2658 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationX", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationX", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 101, - "column": 0, - "index": 2660 - }, - "end": { - "line": 108, - "column": 3, - "index": 2923 - } - }, - "context": { - "loc": { - "start": { - "line": 109, - "column": 0, - "index": 2924 - }, - "end": { - "line": 109, - "column": 32, - "index": 2956 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationY", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationY", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 111, - "column": 0, - "index": 2958 - }, - "end": { - "line": 118, - "column": 3, - "index": 3221 - } - }, - "context": { - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 3222 - }, - "end": { - "line": 119, - "column": 32, - "index": 3254 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationZ", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationX always contains the rotation of the\ndevice along the x axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES, the value will be -180 to 180. If\nit is set to RADIANS, the value will be -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 132, - "column": 0, - "index": 3568 - }, - "end": { - "line": 162, - "column": 3, - "index": 4447 - } - }, - "context": { - "loc": { - "start": { - "line": 163, - "column": 0, - "index": 4448 - }, - "end": { - "line": 163, - "column": 27, - "index": 4475 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationX", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationX", - "scope": "instance" - } - ], - "namespace": "p5#rotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationY always contains the rotation of the\ndevice along the y axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 165, - "column": 0, - "index": 4477 - }, - "end": { - "line": 195, - "column": 3, - "index": 5358 - } - }, - "context": { - "loc": { - "start": { - "line": 196, - "column": 0, - "index": 5359 - }, - "end": { - "line": 196, - "column": 27, - "index": 5386 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationY", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationY", - "scope": "instance" - } - ], - "namespace": "p5#rotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationZ always contains the rotation of the\ndevice along the z axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Unlike rotationX and rotationY, this variable is available for devices\nwith a built-in compass only." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - }, - { - "title": "property", - "description": null, - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 33 - } - ], - "loc": { - "start": { - "line": 198, - "column": 0, - "index": 5388 - }, - "end": { - "line": 232, - "column": 3, - "index": 6377 - } - }, - "context": { - "loc": { - "start": { - "line": 233, - "column": 0, - "index": 6378 - }, - "end": { - "line": 233, - "column": 27, - "index": 6405 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationZ", - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationZ", - "scope": "instance" - } - ], - "namespace": "p5#rotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES,\nthe value will be -180 to 180. If it is set to RADIANS, the value will\nbe -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationX can also be used with rotationX to determine the rotate\ndirection of the device along the X-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 40 - } - ], - "loc": { - "start": { - "line": 235, - "column": 0, - "index": 6407 - }, - "end": { - "line": 276, - "column": 3, - "index": 7745 - } - }, - "context": { - "loc": { - "start": { - "line": 277, - "column": 0, - "index": 7746 - }, - "end": { - "line": 277, - "column": 28, - "index": 7774 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationX", - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationX", - "scope": "instance" - } - ], - "namespace": "p5#pRotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationY can also be used with rotationY to determine the rotate\ndirection of the device along the Y-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 39 - } - ], - "loc": { - "start": { - "line": 279, - "column": 0, - "index": 7776 - }, - "end": { - "line": 319, - "column": 3, - "index": 9113 - } - }, - "context": { - "loc": { - "start": { - "line": 320, - "column": 0, - "index": 9114 - }, - "end": { - "line": 320, - "column": 28, - "index": 9142 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationY", - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationY", - "scope": "instance" - } - ], - "namespace": "p5#pRotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationZ can also be used with rotationZ to determine the rotate\ndirection of the device along the Z-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 35 - } - ], - "loc": { - "start": { - "line": 322, - "column": 0, - "index": 9144 - }, - "end": { - "line": 358, - "column": 3, - "index": 10350 - } - }, - "context": { - "loc": { - "start": { - "line": 359, - "column": 0, - "index": 10351 - }, - "end": { - "line": 359, - "column": 28, - "index": 10379 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationZ", - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationZ", - "scope": "instance" - } - ], - "namespace": "p5#pRotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When a device is rotated, the axis that triggers the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "deviceTurned()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nmethod is stored in the turnAxis variable. The turnAxis variable is only defined within\nthe scope of deviceTurned()." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "turnAxis" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 379, - "column": 0, - "index": 10890 - }, - "end": { - "line": 412, - "column": 3, - "index": 11826 - } - }, - "context": { - "loc": { - "start": { - "line": 413, - "column": 0, - "index": 11827 - }, - "end": { - "line": 413, - "column": 34, - "index": 11861 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "turnAxis", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "turnAxis", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "turnAxis", - "scope": "instance" - } - ], - "namespace": "p5#turnAxis" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyIsPressed" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is true if any key is pressed\nand false if no keys are pressed." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "keyIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 111 - }, - "end": { - "line": 30, - "column": 3, - "index": 575 - } - }, - "context": { - "loc": { - "start": { - "line": 31, - "column": 0, - "index": 576 - }, - "end": { - "line": 31, - "column": 34, - "index": 610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "isKeyPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "isKeyPressed", - "scope": "instance" - } - ], - "namespace": "p5#isKeyPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyTyped()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". For non-ASCII keys, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyCode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nvariable." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "key" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 34, - "column": 0, - "index": 655 - }, - "end": { - "line": 57, - "column": 3, - "index": 1373 - } - }, - "context": { - "loc": { - "start": { - "line": 58, - "column": 0, - "index": 1374 - }, - "end": { - "line": 58, - "column": 22, - "index": 1396 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "key", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "key", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "key", - "scope": "instance" - } - ], - "namespace": "p5#key" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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: " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keycode.info" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "keyCode" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 60, - "column": 0, - "index": 1398 - }, - "end": { - "line": 95, - "column": 3, - "index": 2425 - } - }, - "context": { - "loc": { - "start": { - "line": 96, - "column": 0, - "index": 2426 - }, - "end": { - "line": 96, - "column": 25, - "index": 2451 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyCode", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "keyCode", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "keyCode", - "scope": "instance" - } - ], - "namespace": "p5#keyCode" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The onblur function is called when the user is no longer focused\non the p5 element. Because the keyup events will not fire if the user is\nnot focused on the element we must assume all keys currently down have\nbeen released." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 291, - "column": 0, - "index": 8735 - }, - "end": { - "line": 296, - "column": 3, - "index": 8978 - } - }, - "context": { - "loc": { - "start": { - "line": 297, - "column": 0, - "index": 8979 - }, - "end": { - "line": 299, - "column": 2, - "index": 9041 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "e", - "lineNumber": 297 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_onblur", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_onblur", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_onblur" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedX contains the horizontal movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 4 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 40, - "column": 3, - "index": 777 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 778 - }, - "end": { - "line": 41, - "column": 24, - "index": 802 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedX", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedX", - "scope": "instance" - } - ], - "namespace": "p5#movedX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedY contains the vertical movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 43, - "column": 0, - "index": 804 - }, - "end": { - "line": 70, - "column": 3, - "index": 1394 - } - }, - "context": { - "loc": { - "start": { - "line": 71, - "column": 0, - "index": 1395 - }, - "end": { - "line": 71, - "column": 24, - "index": 1419 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedY", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedY", - "scope": "instance" - } - ], - "namespace": "p5#movedY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 80, - "column": 0, - "index": 1666 - }, - "end": { - "line": 101, - "column": 3, - "index": 2316 - } - }, - "context": { - "loc": { - "start": { - "line": 102, - "column": 0, - "index": 2317 - }, - "end": { - "line": 102, - "column": 24, - "index": 2341 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseX", - "scope": "instance" - } - ], - "namespace": "p5#mouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 2343 - }, - "end": { - "line": 125, - "column": 3, - "index": 2986 - } - }, - "context": { - "loc": { - "start": { - "line": 126, - "column": 0, - "index": 2987 - }, - "end": { - "line": 126, - "column": 24, - "index": 3011 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseY", - "scope": "instance" - } - ], - "namespace": "p5#mouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 128, - "column": 0, - "index": 3013 - }, - "end": { - "line": 156, - "column": 3, - "index": 3890 - } - }, - "context": { - "loc": { - "start": { - "line": 157, - "column": 0, - "index": 3891 - }, - "end": { - "line": 157, - "column": 25, - "index": 3916 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseX", - "scope": "instance" - } - ], - "namespace": "p5#pmouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 159, - "column": 0, - "index": 3918 - }, - "end": { - "line": 186, - "column": 3, - "index": 4745 - } - }, - "context": { - "loc": { - "start": { - "line": 187, - "column": 0, - "index": 4746 - }, - "end": { - "line": 187, - "column": 25, - "index": 4771 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseY", - "scope": "instance" - } - ], - "namespace": "p5#pmouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseX always contains the current horizontal\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 189, - "column": 0, - "index": 4773 - }, - "end": { - "line": 223, - "column": 3, - "index": 5653 - } - }, - "context": { - "loc": { - "start": { - "line": 224, - "column": 0, - "index": 5654 - }, - "end": { - "line": 224, - "column": 27, - "index": 5681 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseX", - "scope": "instance" - } - ], - "namespace": "p5#winMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseY always contains the current vertical\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 226, - "column": 0, - "index": 5683 - }, - "end": { - "line": 260, - "column": 3, - "index": 6560 - } - }, - "context": { - "loc": { - "start": { - "line": 261, - "column": 0, - "index": 6561 - }, - "end": { - "line": 261, - "column": 27, - "index": 6588 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseY", - "scope": "instance" - } - ], - "namespace": "p5#winMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 263, - "column": 0, - "index": 6590 - }, - "end": { - "line": 299, - "column": 3, - "index": 7675 - } - }, - "context": { - "loc": { - "start": { - "line": 300, - "column": 0, - "index": 7676 - }, - "end": { - "line": 300, - "column": 28, - "index": 7704 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseX", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseX", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 302, - "column": 0, - "index": 7706 - }, - "end": { - "line": 338, - "column": 3, - "index": 8785 - } - }, - "context": { - "loc": { - "start": { - "line": 339, - "column": 0, - "index": 8786 - }, - "end": { - "line": 339, - "column": 28, - "index": 8814 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseY", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseY", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - }, - "name": "mouseButton" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 341, - "column": 0, - "index": 8816 - }, - "end": { - "line": 375, - "column": 3, - "index": 9715 - } - }, - "context": { - "loc": { - "start": { - "line": 376, - "column": 0, - "index": 9716 - }, - "end": { - "line": 376, - "column": 29, - "index": 9745 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseButton", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseButton", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseButton", - "scope": "instance" - } - ], - "namespace": "p5#mouseButton" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable mouseIsPressed is true if the mouse is pressed\nand false if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "mouseIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 378, - "column": 0, - "index": 9747 - }, - "end": { - "line": 404, - "column": 3, - "index": 10289 - } - }, - "context": { - "loc": { - "start": { - "line": 405, - "column": 0, - "index": 10290 - }, - "end": { - "line": 405, - "column": 36, - "index": 10326 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseIsPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseIsPressed", - "scope": "instance" - } - ], - "namespace": "p5#mouseIsPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The touches[] array is not supported on Safari and IE on touch-based\ndesktops (laptops)." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - }, - "name": "touches" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 108 - }, - "end": { - "line": 37, - "column": 3, - "index": 883 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 884 - }, - "end": { - "line": 38, - "column": 26, - "index": 910 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/touch.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "touches", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "touches", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "touches", - "scope": "instance" - } - ], - "namespace": "p5#touches" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An array containing the color of each pixel on the canvas. Colors are\nstored as numbers representing red, green, blue, and alpha (RGBA) values.\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " is a one-dimensional array for performance reasons." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Each pixel occupies four elements in the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array, one for each RGBA\nvalue. For example, the pixel at coordinates (0, 0) stores its RGBA values\nat " - }, - { - "type": "inlineCode", - "value": "pixels[0]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[1]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[2]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[3]" - }, - { - "type": "text", - "value": ", respectively.\nThe next pixel at coordinates (1, 0) stores its RGBA values at " - }, - { - "type": "inlineCode", - "value": "pixels[4]" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "inlineCode", - "value": "pixels[5]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[6]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[7]" - }, - { - "type": "text", - "value": ". And so on. The " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array\nfor a 100×100 canvas has 100 × 100 × 4 = 40,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Some displays use several smaller pixels to set the color at a single\npoint. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function returns\nthe pixel density of the canvas. High density displays often have a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " of 2. On such a display, the\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array for a 100×100 canvas has 200 × 200 × 4 =\n160,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Accessing the RGBA values for a point on the canvas requires a little math\nas shown below. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadPixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function\nmust be called before accessing the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array. The\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "updatePixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function must be called\nafter any changes are made." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "pixels" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 169 - }, - "end": { - "line": 103, - "column": 3, - "index": 3031 - } - }, - "context": { - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 3032 - }, - "end": { - "line": 104, - "column": 25, - "index": 3057 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pixels", - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pixels", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pixels", - "scope": "instance" - } - ], - "namespace": "p5#pixels" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function to measure ascent and descent." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 362, - "column": 0, - "index": 9474 - }, - "end": { - "line": 364, - "column": 3, - "index": 9531 - } - }, - "context": { - "loc": { - "start": { - "line": 365, - "column": 0, - "index": 9532 - }, - "end": { - "line": 367, - "column": 2, - "index": 9627 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_updateTextMetrics", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_updateTextMetrics", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_updateTextMetrics" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ensures that p5 is using a 3d renderer. throws an error if not." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2350, - "column": 0, - "index": 73393 - }, - "end": { - "line": 2352, - "column": 3, - "index": 73467 - } - }, - "context": { - "loc": { - "start": { - "line": 2353, - "column": 0, - "index": 73468 - }, - "end": { - "line": 2358, - "column": 2, - "index": 73742 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "name", - "lineNumber": 2353 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_assert3d", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_assert3d", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_assert3d" - } - ], - "events": [], - "static": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Turn off some features of the friendly error system (FES), which can give\na significant boost to performance when needed." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ndisabling the friendly error system" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "disableFriendlyErrors" - }, - { - "title": "example", - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 754, - "column": 0, - "index": 26038 - }, - "end": { - "line": 776, - "column": 3, - "index": 26889 - } - }, - "context": { - "loc": { - "start": { - "line": 777, - "column": 0, - "index": 26890 - }, - "end": { - "line": 777, - "column": 33, - "index": 26923 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "disableFriendlyErrors", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "disableFriendlyErrors", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "disableFriendlyErrors", - "scope": "static" - } - ], - "namespace": "p5.disableFriendlyErrors" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Path to the media element's source as a string." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.MediaElement", - "lineNumber": 3 - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "src" - }, - { - "title": "return", - "description": "src", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 4842, - "column": 0, - "index": 139686 - }, - "end": { - "line": 4868, - "column": 3, - "index": 140231 - } - }, - "context": { - "loc": { - "start": { - "line": 4958, - "column": 0, - "index": 142394 - }, - "end": { - "line": 5009, - "column": 2, - "index": 143967 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "src" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "File", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "File", - "scope": "static" - } - ], - "namespace": "p5.File" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Table Options\nGeneric class for handling tabular data, typically from a\nCSV, TSV, or other sort of spreadsheet file.\nCSV files are\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ncomma separated values" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", often with the data in quotes. TSV\nfiles use tabs as separators, and usually don't bother with the\nquotes.\nFile names should end with .csv if they're comma separated.\nA rough \"spec\" for CSV can be found\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "here" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nTo load files, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method.\nTo save tables to your computer, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "save" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method\nor the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "saveTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Possible options include:" - } - ] - }, - { - "type": "html", - "value": "
    \n
  • csv - parse the table as comma-separated values\n
  • tsv - parse the table as tab-separated values\n
  • header - this table has a header (title) row\n
" - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 93 - }, - "end": { - "line": 31, - "column": 3, - "index": 1053 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 1379 - }, - "end": { - "line": 1259, - "column": 2, - "index": 33791 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "Table", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addRow()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new row of data to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "set()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object is included as a parameter, then that row is\nduplicated and added to the table." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row to be added to the table", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - "name": "row" - }, - { - "title": "return", - "description": "the row that was added", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 47, - "column": 2, - "index": 1476 - }, - "end": { - "line": 94, - "column": 3, - "index": 2995 - } - }, - "context": { - "loc": { - "start": { - "line": 95, - "column": 2, - "index": 2998 - }, - "end": { - "line": 106, - "column": 3, - "index": 3319 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row to be added to the table" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the row that was added" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes a row from the table object." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to remove", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "id" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 108, - "column": 2, - "index": 3323 - }, - "end": { - "line": 145, - "column": 3, - "index": 4202 - } - }, - "context": { - "loc": { - "start": { - "line": 146, - "column": 2, - "index": 4205 - }, - "end": { - "line": 151, - "column": 3, - "index": 4410 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "id", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to remove" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a reference to the specified " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". The reference\ncan then be used to get and set values of the selected row." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to get", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "rowID" - }, - { - "title": "return", - "description": "p5.TableRow object", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 153, - "column": 2, - "index": 4414 - }, - "end": { - "line": 191, - "column": 3, - "index": 5463 - } - }, - "context": { - "loc": { - "start": { - "line": 192, - "column": 2, - "index": 5466 - }, - "end": { - "line": 194, - "column": 3, - "index": 5507 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "r", - "lineNumber": 192 - }, - { - "title": "param", - "name": "rowID", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to get" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Gets all rows from the table. Returns an array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Array of p5.TableRows", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 196, - "column": 2, - "index": 5511 - }, - "end": { - "line": 237, - "column": 3, - "index": 6588 - } - }, - "context": { - "loc": { - "start": { - "line": 238, - "column": 2, - "index": 6591 - }, - "end": { - "line": 240, - "column": 3, - "index": 6629 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 242, - "column": 2, - "index": 6633 - }, - "end": { - "line": 282, - "column": 3, - "index": 7805 - } - }, - "context": { - "loc": { - "start": { - "line": 283, - "column": 2, - "index": 7808 - }, - "end": { - "line": 301, - "column": 3, - "index": 8272 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 10, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 303, - "column": 2, - "index": 8276 - }, - "end": { - "line": 348, - "column": 3, - "index": 9683 - } - }, - "context": { - "loc": { - "start": { - "line": 349, - "column": 2, - "index": 9686 - }, - "end": { - "line": 366, - "column": 3, - "index": 10136 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "TableRow object", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 368, - "column": 2, - "index": 10140 - }, - "end": { - "line": 407, - "column": 3, - "index": 11362 - } - }, - "context": { - "loc": { - "start": { - "line": 408, - "column": 2, - "index": 11365 - }, - "end": { - "line": 423, - "column": 3, - "index": 11778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "TableRow object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 425, - "column": 2, - "index": 11782 - }, - "end": { - "line": 472, - "column": 3, - "index": 13226 - } - }, - "context": { - "loc": { - "start": { - "line": 473, - "column": 2, - "index": 13229 - }, - "end": { - "line": 489, - "column": 3, - "index": 13668 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all values in the specified column, and returns them\nas an array. The column may be specified by either its ID or title." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String or Number of the column to return", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "Array of column values", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 491, - "column": 2, - "index": 13672 - }, - "end": { - "line": 525, - "column": 3, - "index": 14658 - } - }, - "context": { - "loc": { - "start": { - "line": 526, - "column": 2, - "index": 14661 - }, - "end": { - "line": 538, - "column": 3, - "index": 14980 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 526 - }, - { - "title": "param", - "name": "column", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String or Number of the column to return" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of column values" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes all rows from a Table. While all rows are removed,\ncolumns and column titles are maintained." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 540, - "column": 2, - "index": 14984 - }, - "end": { - "line": 571, - "column": 3, - "index": 15789 - } - }, - "context": { - "loc": { - "start": { - "line": 572, - "column": 2, - "index": 15792 - }, - "end": { - "line": 575, - "column": 3, - "index": 15852 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clearRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "clearRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#clearRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new column to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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.)" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "title of the given column", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "title" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 577, - "column": 2, - "index": 15856 - }, - "end": { - "line": 619, - "column": 3, - "index": 17079 - } - }, - "context": { - "loc": { - "start": { - "line": 620, - "column": 2, - "index": 17082 - }, - "end": { - "line": 623, - "column": 3, - "index": 17160 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "title", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "title of the given column" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of columns in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of columns in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 625, - "column": 2, - "index": 17164 - }, - "end": { - "line": 655, - "column": 3, - "index": 17854 - } - }, - "context": { - "loc": { - "start": { - "line": 656, - "column": 2, - "index": 17857 - }, - "end": { - "line": 658, - "column": 3, - "index": 17912 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of columns in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumnCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumnCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumnCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of rows in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of rows in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 660, - "column": 2, - "index": 17916 - }, - "end": { - "line": 690, - "column": 3, - "index": 18564 - } - }, - "context": { - "loc": { - "start": { - "line": 691, - "column": 2, - "index": 18567 - }, - "end": { - "line": 693, - "column": 3, - "index": 18616 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of rows in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRowCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRowCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRowCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes any of the specified characters (or \"tokens\")." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String listing characters to be removed", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "chars" - }, - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 695, - "column": 2, - "index": 18620 - }, - "end": { - "line": 730, - "column": 3, - "index": 19601 - } - }, - "context": { - "loc": { - "start": { - "line": 731, - "column": 2, - "index": 19604 - }, - "end": { - "line": 764, - "column": 3, - "index": 20779 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "chars", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String listing characters to be removed" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeTokens", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeTokens", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeTokens" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 766, - "column": 2, - "index": 20783 - }, - "end": { - "line": 798, - "column": 3, - "index": 21711 - } - }, - "context": { - "loc": { - "start": { - "line": 799, - "column": 2, - "index": 21714 - }, - "end": { - "line": 827, - "column": 3, - "index": 22666 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "trim", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "trim", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#trim" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "removeColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "columnName (string) or ID (number)", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 829, - "column": 2, - "index": 22670 - }, - "end": { - "line": 864, - "column": 3, - "index": 23691 - } - }, - "context": { - "loc": { - "start": { - "line": 865, - "column": 2, - "index": 23694 - }, - "end": { - "line": 888, - "column": 3, - "index": 24362 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "c", - "lineNumber": 865 - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or ID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 890, - "column": 2, - "index": 24366 - }, - "end": { - "line": 932, - "column": 3, - "index": 25518 - } - }, - "context": { - "loc": { - "start": { - "line": 933, - "column": 2, - "index": 25521 - }, - "end": { - "line": 935, - "column": 3, - "index": 25590 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "set", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "set", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#set" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 937, - "column": 2, - "index": 25594 - }, - "end": { - "line": 976, - "column": 3, - "index": 26578 - } - }, - "context": { - "loc": { - "start": { - "line": 977, - "column": 2, - "index": 26581 - }, - "end": { - "line": 979, - "column": 3, - "index": 26656 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 981, - "column": 2, - "index": 26660 - }, - "end": { - "line": 1019, - "column": 3, - "index": 27767 - } - }, - "context": { - "loc": { - "start": { - "line": 1020, - "column": 2, - "index": 27770 - }, - "end": { - "line": 1022, - "column": 3, - "index": 27851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1024, - "column": 2, - "index": 27855 - }, - "end": { - "line": 1062, - "column": 3, - "index": 28842 - } - }, - "context": { - "loc": { - "start": { - "line": 1063, - "column": 2, - "index": 28845 - }, - "end": { - "line": 1065, - "column": 3, - "index": 28907 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "get", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "get", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#get" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1067, - "column": 2, - "index": 28911 - }, - "end": { - "line": 1103, - "column": 3, - "index": 29853 - } - }, - "context": { - "loc": { - "start": { - "line": 1104, - "column": 2, - "index": 29856 - }, - "end": { - "line": 1106, - "column": 3, - "index": 29924 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1108, - "column": 2, - "index": 29928 - }, - "end": { - "line": 1151, - "column": 3, - "index": 31214 - } - }, - "context": { - "loc": { - "start": { - "line": 1153, - "column": 2, - "index": 31218 - }, - "end": { - "line": 1155, - "column": 3, - "index": 31292 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Name of the column which should be used to\n title each row object (optional)", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "headerColumn" - }, - { - "title": "return", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 1157, - "column": 2, - "index": 31296 - }, - "end": { - "line": 1195, - "column": 3, - "index": 32265 - } - }, - "context": { - "loc": { - "start": { - "line": 1196, - "column": 2, - "index": 32268 - }, - "end": { - "line": 1216, - "column": 3, - "index": 32851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "headerColumn", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Name of the column which should be used to\ntitle each row object (optional)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getObject", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getObject", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getObject" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all table data and returns it as a multidimensional array." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 1218, - "column": 2, - "index": 32855 - }, - "end": { - "line": 1251, - "column": 3, - "index": 33622 - } - }, - "context": { - "loc": { - "start": { - "line": 1252, - "column": 2, - "index": 33625 - }, - "end": { - "line": 1258, - "column": 3, - "index": 33788 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getArray", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getArray" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - } - ], - "namespace": "p5.Table" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An internal class to store data that will be sent to a p5.RenderBuffer.\nThose need to eventually go into a Float32Array, so this class provides a\nvariable-length array container backed by a Float32Array so that it can be\nsent to the GPU without allocating a new array each frame." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Like a C++ vector, its fixed-length Float32Array backing its contents will\ndouble in size when it goes over its capacity." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 3, - "column": 0, - "index": 32 - }, - "end": { - "line": 27, - "column": 3, - "index": 926 - } - }, - "context": { - "loc": { - "start": { - "line": 28, - "column": 0, - "index": 927 - }, - "end": { - "line": 108, - "column": 2, - "index": 2998 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "DataArray", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a Float32Array window sized to the exact length of the data" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 35, - "column": 2, - "index": 1114 - }, - "end": { - "line": 37, - "column": 5, - "index": 1196 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 2, - "index": 1199 - }, - "end": { - "line": 40, - "column": 3, - "index": 1258 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dataArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "dataArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#dataArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A \"soft\" clear, which keeps the underlying storage size the same, but\nempties the contents of its dataArray()" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 42, - "column": 2, - "index": 1262 - }, - "end": { - "line": 45, - "column": 5, - "index": 1391 - } - }, - "context": { - "loc": { - "start": { - "line": 46, - "column": 2, - "index": 1394 - }, - "end": { - "line": 48, - "column": 3, - "index": 1428 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clear", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "clear", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#clear" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Can be used to scale a DataArray back down to fit its contents." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 50, - "column": 2, - "index": 1432 - }, - "end": { - "line": 52, - "column": 5, - "index": 1510 - } - }, - "context": { - "loc": { - "start": { - "line": 53, - "column": 2, - "index": 1513 - }, - "end": { - "line": 61, - "column": 3, - "index": 1839 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rescale", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "rescale", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#rescale" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A full reset, which allocates a new underlying Float32Array at its initial\nlength" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 63, - "column": 2, - "index": 1843 - }, - "end": { - "line": 66, - "column": 5, - "index": 1944 - } - }, - "context": { - "loc": { - "start": { - "line": 67, - "column": 2, - "index": 1947 - }, - "end": { - "line": 70, - "column": 3, - "index": 2032 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "reset", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "reset", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#reset" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Adds values to the DataArray, expanding its internal storage to\naccommodate the new items." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 72, - "column": 2, - "index": 2036 - }, - "end": { - "line": 75, - "column": 5, - "index": 2146 - } - }, - "context": { - "loc": { - "start": { - "line": 76, - "column": 2, - "index": 2149 - }, - "end": { - "line": 80, - "column": 3, - "index": 2296 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "values", - "lineNumber": 76, - "type": { - "type": "RestType" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "push", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "push", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#push" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a copy of the data from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to the index\n" - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 82, - "column": 2, - "index": 2300 - }, - "end": { - "line": 85, - "column": 5, - "index": 2409 - } - }, - "context": { - "loc": { - "start": { - "line": 86, - "column": 2, - "index": 2412 - }, - "end": { - "line": 88, - "column": 3, - "index": 2494 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 86 - }, - { - "title": "param", - "name": "to", - "lineNumber": 86 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "slice", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "slice", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#slice" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a mutable Float32Array window from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to\nthe index " - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 90, - "column": 2, - "index": 2498 - }, - "end": { - "line": 93, - "column": 5, - "index": 2618 - } - }, - "context": { - "loc": { - "start": { - "line": 94, - "column": 2, - "index": 2621 - }, - "end": { - "line": 96, - "column": 3, - "index": 2709 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 94 - }, - { - "title": "param", - "name": "to", - "lineNumber": 94 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "subArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "subArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#subArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Expand capacity of the internal storage until it can fit a target size" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 98, - "column": 2, - "index": 2713 - }, - "end": { - "line": 100, - "column": 5, - "index": 2798 - } - }, - "context": { - "loc": { - "start": { - "line": 101, - "column": 2, - "index": 2801 - }, - "end": { - "line": 107, - "column": 3, - "index": 2995 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "target", - "lineNumber": 101 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "ensureLength", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "ensureLength", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#ensureLength" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - } - ], - "namespace": "p5.DataArray" - } - ] - }, - "path": [ - { - "name": "p5" - } - ], - "namespace": "p5" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Welcome to RendererGL Immediate Mode.\nImmediate mode is used for drawing custom shapes\nfrom a set of vertices. Immediate Mode is activated\nwhen you call " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " & de-activated when you call " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nImmediate mode is a style of programming borrowed\nfrom OpenGL's (now-deprecated) immediate mode.\nIt differs from p5.js' default, Retained Mode, which caches\ngeometries and buffers on the CPU to reduce the number of webgl\ndraw calls. Retained mode is more efficient & performative,\nhowever, Immediate Mode is useful for sketching quick\ngeometric ideas." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 13, - "column": 3, - "index": 658 - } - }, - "context": { - "loc": { - "start": { - "line": 14, - "column": 0, - "index": 659 - }, - "end": { - "line": 14, - "column": 30, - "index": 689 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.Immediate.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "p5", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the number of frames drawn since the sketch started." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "frameCount" - }, - { - "type": "text", - "value": "'s value is 0 inside " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". It\nincrements by 1 each time the code in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfinishes executing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "frameCount" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 69, - "column": 0, - "index": 1553 - }, - "end": { - "line": 116, - "column": 3, - "index": 2581 - } - }, - "context": { - "loc": { - "start": { - "line": 117, - "column": 0, - "index": 2582 - }, - "end": { - "line": 117, - "column": 28, - "index": 2610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "frameCount", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "frameCount", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "frameCount", - "scope": "instance" - } - ], - "namespace": "p5#frameCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks the amount of time, in milliseconds, it took for\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to draw the previous frame. " - }, - { - "type": "inlineCode", - "value": "deltaTime" - }, - { - "type": "text", - "value": " is\nuseful for simulating physics." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "deltaTime" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 2612 - }, - "end": { - "line": 161, - "column": 3, - "index": 3539 - } - }, - "context": { - "loc": { - "start": { - "line": 162, - "column": 0, - "index": 3540 - }, - "end": { - "line": 162, - "column": 27, - "index": 3567 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deltaTime", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deltaTime", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deltaTime", - "scope": "instance" - } - ], - "namespace": "p5#deltaTime" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tracks whether the browser window is focused and can receive user input.\n" - }, - { - "type": "inlineCode", - "value": "focused" - }, - { - "type": "text", - "value": " is " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": " if the window if focused and " - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "focused" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 164, - "column": 0, - "index": 3569 - }, - "end": { - "line": 190, - "column": 3, - "index": 4257 - } - }, - "context": { - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 4258 - }, - "end": { - "line": 191, - "column": 43, - "index": 4301 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "focused", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "focused", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "focused", - "scope": "instance" - } - ], - "namespace": "p5#focused" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A string variable with the WebGL version in use. Its value equals one of\nthe followin string constants:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL2" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl2'" - }, - { - "type": "text", - "value": "," - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'webgl'" - }, - { - "type": "text", - "value": ", or" - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "P2D" - }, - { - "type": "text", - "value": " whose value is " - }, - { - "type": "inlineCode", - "value": "'p2d'" - }, - { - "type": "text", - "value": ". This is the default for 2D sketches." - } - ] - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setAttributes()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for ways to set the\nWebGL version." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - }, - "name": "webglVersion" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 12 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 466, - "column": 0, - "index": 12055 - }, - "end": { - "line": 544, - "column": 3, - "index": 13784 - } - }, - "context": { - "loc": { - "start": { - "line": 545, - "column": 0, - "index": 13785 - }, - "end": { - "line": 545, - "column": 34, - "index": 13819 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "webglVersion", - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WEBGL" - }, - { - "type": "NameExpression", - "name": "WEBGL2" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "webglVersion", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "webglVersion", - "scope": "instance" - } - ], - "namespace": "p5#webglVersion" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayWidth" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen width can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayWidth * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 547, - "column": 0, - "index": 13821 - }, - "end": { - "line": 574, - "column": 3, - "index": 14559 - } - }, - "context": { - "loc": { - "start": { - "line": 575, - "column": 0, - "index": 14560 - }, - "end": { - "line": 575, - "column": 41, - "index": 14601 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayWidth", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayWidth", - "scope": "instance" - } - ], - "namespace": "p5#displayWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the screen display. Its value\ndepends on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "displayHeight" - }, - { - "type": "text", - "value": " is useful for running full-screen programs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The actual screen height can be computed as\n" - }, - { - "type": "inlineCode", - "value": "displayHeight * pixelDensity()" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "displayHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 577, - "column": 0, - "index": 14603 - }, - "end": { - "line": 604, - "column": 3, - "index": 15346 - } - }, - "context": { - "loc": { - "start": { - "line": 605, - "column": 0, - "index": 15347 - }, - "end": { - "line": 605, - "column": 43, - "index": 15390 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "displayHeight", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "displayHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "displayHeight", - "scope": "instance" - } - ], - "namespace": "p5#displayHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowWidth" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 607, - "column": 0, - "index": 15392 - }, - "end": { - "line": 631, - "column": 3, - "index": 16081 - } - }, - "context": { - "loc": { - "start": { - "line": 632, - "column": 0, - "index": 16082 - }, - "end": { - "line": 632, - "column": 44, - "index": 16126 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowWidth", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowWidth", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowWidth", - "scope": "instance" - } - ], - "namespace": "p5#windowWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the browser's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "layout viewport" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis viewport is the area within the browser that's available for drawing." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "windowHeight" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 634, - "column": 0, - "index": 16128 - }, - "end": { - "line": 658, - "column": 3, - "index": 16819 - } - }, - "context": { - "loc": { - "start": { - "line": 659, - "column": 0, - "index": 16820 - }, - "end": { - "line": 659, - "column": 46, - "index": 16866 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "windowHeight", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "windowHeight", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "windowHeight", - "scope": "instance" - } - ], - "namespace": "p5#windowHeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the width of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "width" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "width" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 750, - "column": 0, - "index": 19217 - }, - "end": { - "line": 816, - "column": 3, - "index": 20713 - } - }, - "context": { - "loc": { - "start": { - "line": 817, - "column": 0, - "index": 20714 - }, - "end": { - "line": 817, - "column": 23, - "index": 20737 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "width", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "width", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "width", - "scope": "instance" - } - ], - "namespace": "p5#width" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A numeric variable that stores the height of the drawing canvas. Its\ndefault value is 100." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resizeCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " changes the value of\n" - }, - { - "type": "inlineCode", - "value": "height" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " sets its value to\n0." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "height" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 819, - "column": 0, - "index": 20739 - }, - "end": { - "line": 885, - "column": 3, - "index": 22246 - } - }, - "context": { - "loc": { - "start": { - "line": 886, - "column": 0, - "index": 22247 - }, - "end": { - "line": 886, - "column": 24, - "index": 22271 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "height", - "lineNumber": 64, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "height", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "height", - "scope": "instance" - } - ], - "namespace": "p5#height" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "nothing displayed", - "lineNumber": 20 - } - ], - "loc": { - "start": { - "line": 317, - "column": 4, - "index": 10982 - }, - "end": { - "line": 340, - "column": 7, - "index": 11811 - } - }, - "context": { - "loc": { - "start": { - "line": 341, - "column": 4, - "index": 11816 - }, - "end": { - "line": 402, - "column": 6, - "index": 13726 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "remove", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "remove", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#remove" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function does 3 things:" - } - ] - }, - { - "type": "list", - "ordered": true, - "start": 1, - "spread": true, - "children": [ - { - "type": "listItem", - "spread": true, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Bounds the desired start/stop angles for an arc (in radians) so that:" - } - ] - }, - { - "type": "code", - "lang": null, - "meta": null, - "value": "0 <= start < TWO_PI ; start <= stop < start + TWO_PI" - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This means that the arc rendering functions don't have to be concerned\nwith what happens if stop is smaller than start, or if the arc 'goes\nround more than once', etc.: they can just start at start and increase\nuntil stop and the correct arc will be drawn." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Optionally adjusts the angles within each quadrant to counter the naive\nscaling of the underlying ellipse up from the unit circle. Without\nthis, the angles become arbitrary when width != height: 45 degrees\nmight be drawn at 5 degrees on a 'wide' ellipse, or at 85 degrees on\na 'tall' ellipse." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Flags up when start and stop correspond to the same place on the\nunderlying ellipse. This is useful if you want to do something special\nthere (like rendering a whole ellipse instead)." - } - ] - } - ] - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 16, - "column": 0, - "index": 333 - }, - "end": { - "line": 37, - "column": 3, - "index": 1365 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 1366 - }, - "end": { - "line": 100, - "column": 2, - "index": 3623 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "start", - "lineNumber": 39 - }, - { - "title": "param", - "name": "stop", - "lineNumber": 40 - }, - { - "title": "param", - "name": "width", - "lineNumber": 41 - }, - { - "title": "param", - "name": "height", - "lineNumber": 42 - }, - { - "title": "param", - "name": "correctForScaling", - "lineNumber": 43 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_normalizeArcAngles", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_normalizeArcAngles", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_normalizeArcAngles" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for select and selectAll" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 191, - "column": 0, - "index": 6392 - }, - "end": { - "line": 193, - "column": 3, - "index": 6443 - } - }, - "context": { - "loc": { - "start": { - "line": 194, - "column": 0, - "index": 6444 - }, - "end": { - "line": 204, - "column": 2, - "index": 6751 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "p", - "lineNumber": 194 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_getContainer", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_getContainer", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_getContainer" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for getElement and getElements." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 206, - "column": 0, - "index": 6753 - }, - "end": { - "line": 208, - "column": 3, - "index": 6811 - } - }, - "context": { - "loc": { - "start": { - "line": 209, - "column": 0, - "index": 6812 - }, - "end": { - "line": 238, - "column": 2, - "index": 7767 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "elt", - "lineNumber": 209 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_wrapElement", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_wrapElement", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_wrapElement" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "INPUT *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 715, - "column": 0, - "index": 21883 - }, - "end": { - "line": 715, - "column": 13, - "index": 21896 - } - }, - "context": { - "loc": { - "start": { - "line": 827, - "column": 0, - "index": 24953 - }, - "end": { - "line": 840, - "column": 2, - "index": 25384 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "min", - "lineNumber": 827 - }, - { - "title": "param", - "name": "max", - "lineNumber": 827 - }, - { - "title": "param", - "name": "value", - "lineNumber": 827 - }, - { - "title": "param", - "name": "step", - "lineNumber": 827 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createSlider", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createSlider", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createSlider" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "AUDIO STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2041, - "column": 0, - "index": 61417 - }, - "end": { - "line": 2041, - "column": 19, - "index": 61436 - } - }, - "context": { - "loc": { - "start": { - "line": 2080, - "column": 0, - "index": 62975 - }, - "end": { - "line": 2083, - "column": 2, - "index": 63135 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "src", - "lineNumber": 2080 - }, - { - "title": "param", - "name": "callback", - "lineNumber": 2080 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createAudio", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "createAudio", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#createAudio" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "CAMERA STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2085, - "column": 0, - "index": 63137 - }, - "end": { - "line": 2085, - "column": 20, - "index": 63157 - } - }, - "context": { - "loc": { - "start": { - "line": 2087, - "column": 0, - "index": 63159 - }, - "end": { - "line": 2087, - "column": 29, - "index": 63188 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "VIDEO", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "VIDEO", - "scope": "instance" - } - ], - "namespace": "p5#VIDEO" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - }, - "name": "deviceOrientation" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 20, - "column": 3, - "index": 511 - } - }, - "context": { - "loc": { - "start": { - "line": 21, - "column": 0, - "index": 512 - }, - "end": { - "line": 22, - "column": 74, - "index": 619 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "deviceOrientation", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - { - "type": "NameExpression", - "name": "PORTRAIT" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "deviceOrientation", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "deviceOrientation", - "scope": "instance" - } - ], - "namespace": "p5#deviceOrientation" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationX always contains the acceleration of the\ndevice along the x axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 24, - "column": 0, - "index": 621 - }, - "end": { - "line": 43, - "column": 3, - "index": 1167 - } - }, - "context": { - "loc": { - "start": { - "line": 44, - "column": 0, - "index": 1168 - }, - "end": { - "line": 44, - "column": 31, - "index": 1199 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationX", - "scope": "instance" - } - ], - "namespace": "p5#accelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationY always contains the acceleration of the\ndevice along the y axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 46, - "column": 0, - "index": 1201 - }, - "end": { - "line": 65, - "column": 3, - "index": 1746 - } - }, - "context": { - "loc": { - "start": { - "line": 66, - "column": 0, - "index": 1747 - }, - "end": { - "line": 66, - "column": 31, - "index": 1778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationY", - "scope": "instance" - } - ], - "namespace": "p5#accelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable accelerationZ always contains the acceleration of the\ndevice along the z axis. Value is represented as meters per second squared." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "accelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 68, - "column": 0, - "index": 1780 - }, - "end": { - "line": 88, - "column": 3, - "index": 2328 - } - }, - "context": { - "loc": { - "start": { - "line": 89, - "column": 0, - "index": 2329 - }, - "end": { - "line": 89, - "column": 31, - "index": 2360 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "accelerationZ", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "accelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "accelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#accelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 91, - "column": 0, - "index": 2362 - }, - "end": { - "line": 98, - "column": 3, - "index": 2625 - } - }, - "context": { - "loc": { - "start": { - "line": 99, - "column": 0, - "index": 2626 - }, - "end": { - "line": 99, - "column": 32, - "index": 2658 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationX", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationX", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 101, - "column": 0, - "index": 2660 - }, - "end": { - "line": 108, - "column": 3, - "index": 2923 - } - }, - "context": { - "loc": { - "start": { - "line": 109, - "column": 0, - "index": 2924 - }, - "end": { - "line": 109, - "column": 32, - "index": 2956 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationY", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationY", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pAccelerationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 111, - "column": 0, - "index": 2958 - }, - "end": { - "line": 118, - "column": 3, - "index": 3221 - } - }, - "context": { - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 3222 - }, - "end": { - "line": 119, - "column": 32, - "index": 3254 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pAccelerationZ", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pAccelerationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pAccelerationZ", - "scope": "instance" - } - ], - "namespace": "p5#pAccelerationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationX always contains the rotation of the\ndevice along the x axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES, the value will be -180 to 180. If\nit is set to RADIANS, the value will be -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 132, - "column": 0, - "index": 3568 - }, - "end": { - "line": 162, - "column": 3, - "index": 4447 - } - }, - "context": { - "loc": { - "start": { - "line": 163, - "column": 0, - "index": 4448 - }, - "end": { - "line": 163, - "column": 27, - "index": 4475 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationX", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationX", - "scope": "instance" - } - ], - "namespace": "p5#rotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationY always contains the rotation of the\ndevice along the y axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 165, - "column": 0, - "index": 4477 - }, - "end": { - "line": 195, - "column": 3, - "index": 5358 - } - }, - "context": { - "loc": { - "start": { - "line": 196, - "column": 0, - "index": 5359 - }, - "end": { - "line": 196, - "column": 27, - "index": 5386 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationY", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationY", - "scope": "instance" - } - ], - "namespace": "p5#rotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable rotationZ always contains the rotation of the\ndevice along the z axis. If the sketch " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nangleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Unlike rotationX and rotationY, this variable is available for devices\nwith a built-in compass only." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - }, - { - "title": "property", - "description": null, - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 33 - } - ], - "loc": { - "start": { - "line": 198, - "column": 0, - "index": 5388 - }, - "end": { - "line": 232, - "column": 3, - "index": 6377 - } - }, - "context": { - "loc": { - "start": { - "line": 233, - "column": 0, - "index": 6378 - }, - "end": { - "line": 233, - "column": 27, - "index": 6405 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "rotationZ", - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "rotationZ", - "scope": "instance" - } - ], - "namespace": "p5#rotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to DEGREES,\nthe value will be -180 to 180. If it is set to RADIANS, the value will\nbe -PI to PI." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationX can also be used with rotationX to determine the rotate\ndirection of the device along the X-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 40 - } - ], - "loc": { - "start": { - "line": 235, - "column": 0, - "index": 6407 - }, - "end": { - "line": 276, - "column": 3, - "index": 7745 - } - }, - "context": { - "loc": { - "start": { - "line": 277, - "column": 0, - "index": 7746 - }, - "end": { - "line": 277, - "column": 28, - "index": 7774 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationX", - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationX", - "scope": "instance" - } - ], - "namespace": "p5#pRotationX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationY can also be used with rotationY to determine the rotate\ndirection of the device along the Y-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 39 - } - ], - "loc": { - "start": { - "line": 279, - "column": 0, - "index": 7776 - }, - "end": { - "line": 319, - "column": 3, - "index": 9113 - } - }, - "context": { - "loc": { - "start": { - "line": 320, - "column": 0, - "index": 9114 - }, - "end": { - "line": 320, - "column": 28, - "index": 9142 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationY", - "lineNumber": 38, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationY", - "scope": "instance" - } - ], - "namespace": "p5#pRotationY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pRotationZ can also be used with rotationZ to determine the rotate\ndirection of the device along the Z-axis." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "property", - "description": null, - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pRotationZ" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 35 - } - ], - "loc": { - "start": { - "line": 322, - "column": 0, - "index": 9144 - }, - "end": { - "line": 358, - "column": 3, - "index": 10350 - } - }, - "context": { - "loc": { - "start": { - "line": 359, - "column": 0, - "index": 10351 - }, - "end": { - "line": 359, - "column": 28, - "index": 10379 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pRotationZ", - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pRotationZ", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pRotationZ", - "scope": "instance" - } - ], - "namespace": "p5#pRotationZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When a device is rotated, the axis that triggers the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "deviceTurned()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nmethod is stored in the turnAxis variable. The turnAxis variable is only defined within\nthe scope of deviceTurned()." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "turnAxis" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 379, - "column": 0, - "index": 10890 - }, - "end": { - "line": 412, - "column": 3, - "index": 11826 - } - }, - "context": { - "loc": { - "start": { - "line": 413, - "column": 0, - "index": 11827 - }, - "end": { - "line": 413, - "column": 34, - "index": 11861 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "turnAxis", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "turnAxis", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "turnAxis", - "scope": "instance" - } - ], - "namespace": "p5#turnAxis" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyIsPressed" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is true if any key is pressed\nand false if no keys are pressed." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "keyIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 111 - }, - "end": { - "line": 30, - "column": 3, - "index": 575 - } - }, - "context": { - "loc": { - "start": { - "line": 31, - "column": 0, - "index": 576 - }, - "end": { - "line": 31, - "column": 34, - "index": 610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "isKeyPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "isKeyPressed", - "scope": "instance" - } - ], - "namespace": "p5#isKeyPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyTyped()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". For non-ASCII keys, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyCode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nvariable." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "key" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 34, - "column": 0, - "index": 655 - }, - "end": { - "line": 57, - "column": 3, - "index": 1373 - } - }, - "context": { - "loc": { - "start": { - "line": 58, - "column": 0, - "index": 1374 - }, - "end": { - "line": 58, - "column": 22, - "index": 1396 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "key", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "key", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "key", - "scope": "instance" - } - ], - "namespace": "p5#key" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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: " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keycode.info" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "keyCode" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 60, - "column": 0, - "index": 1398 - }, - "end": { - "line": 95, - "column": 3, - "index": 2425 - } - }, - "context": { - "loc": { - "start": { - "line": 96, - "column": 0, - "index": 2426 - }, - "end": { - "line": 96, - "column": 25, - "index": 2451 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "keyCode", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "keyCode", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "keyCode", - "scope": "instance" - } - ], - "namespace": "p5#keyCode" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The onblur function is called when the user is no longer focused\non the p5 element. Because the keyup events will not fire if the user is\nnot focused on the element we must assume all keys currently down have\nbeen released." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 291, - "column": 0, - "index": 8735 - }, - "end": { - "line": 296, - "column": 3, - "index": 8978 - } - }, - "context": { - "loc": { - "start": { - "line": 297, - "column": 0, - "index": 8979 - }, - "end": { - "line": 299, - "column": 2, - "index": 9041 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "e", - "lineNumber": 297 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_onblur", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_onblur", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_onblur" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedX contains the horizontal movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 4 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 179 - }, - "end": { - "line": 40, - "column": 3, - "index": 777 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 778 - }, - "end": { - "line": 41, - "column": 24, - "index": 802 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedX", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedX", - "scope": "instance" - } - ], - "namespace": "p5#movedX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The variable movedY contains the vertical movement of the mouse since the last frame" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "movedY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 3 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 43, - "column": 0, - "index": 804 - }, - "end": { - "line": 70, - "column": 3, - "index": 1394 - } - }, - "context": { - "loc": { - "start": { - "line": 71, - "column": 0, - "index": 1395 - }, - "end": { - "line": 71, - "column": 24, - "index": 1419 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "movedY", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "movedY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "movedY", - "scope": "instance" - } - ], - "namespace": "p5#movedY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 80, - "column": 0, - "index": 1666 - }, - "end": { - "line": 101, - "column": 3, - "index": 2316 - } - }, - "context": { - "loc": { - "start": { - "line": 102, - "column": 0, - "index": 2317 - }, - "end": { - "line": 102, - "column": 24, - "index": 2341 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseX", - "scope": "instance" - } - ], - "namespace": "p5#mouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "mouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 2343 - }, - "end": { - "line": 125, - "column": 3, - "index": 2986 - } - }, - "context": { - "loc": { - "start": { - "line": 126, - "column": 0, - "index": 2987 - }, - "end": { - "line": 126, - "column": 24, - "index": 3011 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseY", - "scope": "instance" - } - ], - "namespace": "p5#mouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 128, - "column": 0, - "index": 3013 - }, - "end": { - "line": 156, - "column": 3, - "index": 3890 - } - }, - "context": { - "loc": { - "start": { - "line": 157, - "column": 0, - "index": 3891 - }, - "end": { - "line": 157, - "column": 25, - "index": 3916 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseX", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseX", - "scope": "instance" - } - ], - "namespace": "p5#pmouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pmouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 159, - "column": 0, - "index": 3918 - }, - "end": { - "line": 186, - "column": 3, - "index": 4745 - } - }, - "context": { - "loc": { - "start": { - "line": 187, - "column": 0, - "index": 4746 - }, - "end": { - "line": 187, - "column": 25, - "index": 4771 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pmouseY", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pmouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pmouseY", - "scope": "instance" - } - ], - "namespace": "p5#pmouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseX always contains the current horizontal\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 189, - "column": 0, - "index": 4773 - }, - "end": { - "line": 223, - "column": 3, - "index": 5653 - } - }, - "context": { - "loc": { - "start": { - "line": 224, - "column": 0, - "index": 5654 - }, - "end": { - "line": 224, - "column": 27, - "index": 5681 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseX", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseX", - "scope": "instance" - } - ], - "namespace": "p5#winMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variable winMouseY always contains the current vertical\nposition of the mouse, relative to (0, 0) of the window." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "winMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 226, - "column": 0, - "index": 5683 - }, - "end": { - "line": 260, - "column": 3, - "index": 6560 - } - }, - "context": { - "loc": { - "start": { - "line": 261, - "column": 0, - "index": 6561 - }, - "end": { - "line": 261, - "column": 27, - "index": 6588 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "winMouseY", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "winMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "winMouseY", - "scope": "instance" - } - ], - "namespace": "p5#winMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseX" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 263, - "column": 0, - "index": 6590 - }, - "end": { - "line": 299, - "column": 3, - "index": 7675 - } - }, - "context": { - "loc": { - "start": { - "line": 300, - "column": 0, - "index": 7676 - }, - "end": { - "line": 300, - "column": 28, - "index": 7704 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseX", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseX", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseX", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "pwinMouseY" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 302, - "column": 0, - "index": 7706 - }, - "end": { - "line": 338, - "column": 3, - "index": 8785 - } - }, - "context": { - "loc": { - "start": { - "line": 339, - "column": 0, - "index": 8786 - }, - "end": { - "line": 339, - "column": 28, - "index": 8814 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pwinMouseY", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pwinMouseY", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pwinMouseY", - "scope": "instance" - } - ], - "namespace": "p5#pwinMouseY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - }, - "name": "mouseButton" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 341, - "column": 0, - "index": 8816 - }, - "end": { - "line": 375, - "column": 3, - "index": 9715 - } - }, - "context": { - "loc": { - "start": { - "line": 376, - "column": 0, - "index": 9716 - }, - "end": { - "line": 376, - "column": 29, - "index": 9745 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseButton", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseButton", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseButton", - "scope": "instance" - } - ], - "namespace": "p5#mouseButton" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The boolean system variable mouseIsPressed is true if the mouse is pressed\nand false if not." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "mouseIsPressed" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 378, - "column": 0, - "index": 9747 - }, - "end": { - "line": 404, - "column": 3, - "index": 10289 - } - }, - "context": { - "loc": { - "start": { - "line": 405, - "column": 0, - "index": 10290 - }, - "end": { - "line": 405, - "column": 36, - "index": 10326 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "mouseIsPressed", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "mouseIsPressed", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "mouseIsPressed", - "scope": "instance" - } - ], - "namespace": "p5#mouseIsPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The touches[] array is not supported on Safari and IE on touch-based\ndesktops (laptops)." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - }, - "name": "touches" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 108 - }, - "end": { - "line": 37, - "column": 3, - "index": 883 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 884 - }, - "end": { - "line": 38, - "column": 26, - "index": 910 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/touch.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "touches", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Object" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "touches", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "touches", - "scope": "instance" - } - ], - "namespace": "p5#touches" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An array containing the color of each pixel on the canvas. Colors are\nstored as numbers representing red, green, blue, and alpha (RGBA) values.\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " is a one-dimensional array for performance reasons." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Each pixel occupies four elements in the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array, one for each RGBA\nvalue. For example, the pixel at coordinates (0, 0) stores its RGBA values\nat " - }, - { - "type": "inlineCode", - "value": "pixels[0]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[1]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[2]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[3]" - }, - { - "type": "text", - "value": ", respectively.\nThe next pixel at coordinates (1, 0) stores its RGBA values at " - }, - { - "type": "inlineCode", - "value": "pixels[4]" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "inlineCode", - "value": "pixels[5]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "pixels[6]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "pixels[7]" - }, - { - "type": "text", - "value": ". And so on. The " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array\nfor a 100×100 canvas has 100 × 100 × 4 = 40,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Some displays use several smaller pixels to set the color at a single\npoint. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function returns\nthe pixel density of the canvas. High density displays often have a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixelDensity()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " of 2. On such a display, the\n" - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array for a 100×100 canvas has 200 × 200 × 4 =\n160,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Accessing the RGBA values for a point on the canvas requires a little math\nas shown below. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadPixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function\nmust be called before accessing the " - }, - { - "type": "inlineCode", - "value": "pixels" - }, - { - "type": "text", - "value": " array. The\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "updatePixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function must be called\nafter any changes are made." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "pixels" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 169 - }, - "end": { - "line": 103, - "column": 3, - "index": 3031 - } - }, - "context": { - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 3032 - }, - "end": { - "line": 104, - "column": 25, - "index": 3057 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pixels", - "lineNumber": 25, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pixels", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "pixels", - "scope": "instance" - } - ], - "namespace": "p5#pixels" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function to measure ascent and descent." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 362, - "column": 0, - "index": 9474 - }, - "end": { - "line": 364, - "column": 3, - "index": 9531 - } - }, - "context": { - "loc": { - "start": { - "line": 365, - "column": 0, - "index": 9532 - }, - "end": { - "line": 367, - "column": 2, - "index": 9627 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_updateTextMetrics", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_updateTextMetrics", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_updateTextMetrics" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ensures that p5 is using a 3d renderer. throws an error if not." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 2350, - "column": 0, - "index": 73393 - }, - "end": { - "line": 2352, - "column": 3, - "index": 73467 - } - }, - "context": { - "loc": { - "start": { - "line": 2353, - "column": 0, - "index": 73468 - }, - "end": { - "line": 2358, - "column": 2, - "index": 73742 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "name", - "lineNumber": 2353 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_assert3d", - "kind": "function", - "memberof": "p5", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "_assert3d", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5#_assert3d" - } - ], - "events": [], - "static": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Turn off some features of the friendly error system (FES), which can give\na significant boost to performance when needed." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ndisabling the friendly error system" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "disableFriendlyErrors" - }, - { - "title": "example", - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 754, - "column": 0, - "index": 26038 - }, - "end": { - "line": 776, - "column": 3, - "index": 26889 - } - }, - "context": { - "loc": { - "start": { - "line": 777, - "column": 0, - "index": 26890 - }, - "end": { - "line": 777, - "column": 33, - "index": 26923 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "disableFriendlyErrors", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "disableFriendlyErrors", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "disableFriendlyErrors", - "scope": "static" - } - ], - "namespace": "p5.disableFriendlyErrors" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Path to the media element's source as a string." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.MediaElement", - "lineNumber": 3 - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "src" - }, - { - "title": "return", - "description": "src", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 4842, - "column": 0, - "index": 139686 - }, - "end": { - "line": 4868, - "column": 3, - "index": 140231 - } - }, - "context": { - "loc": { - "start": { - "line": 4958, - "column": 0, - "index": 142394 - }, - "end": { - "line": 5009, - "column": 2, - "index": 143967 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "src" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "File", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "File", - "scope": "static" - } - ], - "namespace": "p5.File" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Table Options\nGeneric class for handling tabular data, typically from a\nCSV, TSV, or other sort of spreadsheet file.\nCSV files are\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ncomma separated values" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", often with the data in quotes. TSV\nfiles use tabs as separators, and usually don't bother with the\nquotes.\nFile names should end with .csv if they're comma separated.\nA rough \"spec\" for CSV can be found\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "here" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nTo load files, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method.\nTo save tables to your computer, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "save" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method\nor the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "saveTable" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Possible options include:" - } - ] - }, - { - "type": "html", - "value": "
    \n
  • csv - parse the table as comma-separated values\n
  • tsv - parse the table as tab-separated values\n
  • header - this table has a header (title) row\n
" - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 93 - }, - "end": { - "line": 31, - "column": 3, - "index": 1053 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 1379 - }, - "end": { - "line": 1259, - "column": 2, - "index": 33791 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "Table", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addRow()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new row of data to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "set()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object is included as a parameter, then that row is\nduplicated and added to the table." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row to be added to the table", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - "name": "row" - }, - { - "title": "return", - "description": "the row that was added", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 47, - "column": 2, - "index": 1476 - }, - "end": { - "line": 94, - "column": 3, - "index": 2995 - } - }, - "context": { - "loc": { - "start": { - "line": 95, - "column": 2, - "index": 2998 - }, - "end": { - "line": 106, - "column": 3, - "index": 3319 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row to be added to the table" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the row that was added" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes a row from the table object." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to remove", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "id" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 108, - "column": 2, - "index": 3323 - }, - "end": { - "line": 145, - "column": 3, - "index": 4202 - } - }, - "context": { - "loc": { - "start": { - "line": 146, - "column": 2, - "index": 4205 - }, - "end": { - "line": 151, - "column": 3, - "index": 4410 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "id", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to remove" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a reference to the specified " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". The reference\ncan then be used to get and set values of the selected row." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "ID number of the row to get", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "rowID" - }, - { - "title": "return", - "description": "p5.TableRow object", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 153, - "column": 2, - "index": 4414 - }, - "end": { - "line": 191, - "column": 3, - "index": 5463 - } - }, - "context": { - "loc": { - "start": { - "line": 192, - "column": 2, - "index": 5466 - }, - "end": { - "line": 194, - "column": 3, - "index": 5507 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "r", - "lineNumber": 192 - }, - { - "title": "param", - "name": "rowID", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number of the row to get" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Gets all rows from the table. Returns an array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Array of p5.TableRows", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 196, - "column": 2, - "index": 5511 - }, - "end": { - "line": 237, - "column": 3, - "index": 6588 - } - }, - "context": { - "loc": { - "start": { - "line": 238, - "column": 2, - "index": 6591 - }, - "end": { - "line": 240, - "column": 3, - "index": 6629 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 242, - "column": 2, - "index": 6633 - }, - "end": { - "line": 282, - "column": 3, - "index": 7805 - } - }, - "context": { - "loc": { - "start": { - "line": 283, - "column": 2, - "index": 7808 - }, - "end": { - "line": 301, - "column": 3, - "index": 8272 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The value to match", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "ID number or title of the\n column to search", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 10, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 303, - "column": 2, - "index": 8276 - }, - "end": { - "line": 348, - "column": 3, - "index": 9683 - } - }, - "context": { - "loc": { - "start": { - "line": 349, - "column": 2, - "index": 9686 - }, - "end": { - "line": 366, - "column": 3, - "index": 10136 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ID number or title of the\ncolumn to search" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "findRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "findRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#findRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "TableRow object", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 368, - "column": 2, - "index": 10140 - }, - "end": { - "line": 407, - "column": 3, - "index": 11362 - } - }, - "context": { - "loc": { - "start": { - "line": 408, - "column": 2, - "index": 11365 - }, - "end": { - "line": 423, - "column": 3, - "index": 11778 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "RegExp" - } - ] - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "TableRow object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.TableRow" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRow", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRow", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "The regular expression to match", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "regexp" - }, - { - "title": "param", - "description": "The column ID (number) or\n title (string)", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "return", - "description": "An Array of TableRow objects", - "lineNumber": 9, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 425, - "column": 2, - "index": 11782 - }, - "end": { - "line": 472, - "column": 3, - "index": 13226 - } - }, - "context": { - "loc": { - "start": { - "line": 473, - "column": 2, - "index": 13229 - }, - "end": { - "line": 489, - "column": 3, - "index": 13668 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "regexp", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The regular expression to match" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The column ID (number) or\ntitle (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An Array of TableRow objects" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "matchRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#matchRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all values in the specified column, and returns them\nas an array. The column may be specified by either its ID or title." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String or Number of the column to return", - "lineNumber": 4, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "Array of column values", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 491, - "column": 2, - "index": 13672 - }, - "end": { - "line": 525, - "column": 3, - "index": 14658 - } - }, - "context": { - "loc": { - "start": { - "line": 526, - "column": 2, - "index": 14661 - }, - "end": { - "line": 538, - "column": 3, - "index": 14980 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 526 - }, - { - "title": "param", - "name": "column", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String or Number of the column to return" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of column values" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes all rows from a Table. While all rows are removed,\ncolumns and column titles are maintained." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 540, - "column": 2, - "index": 14984 - }, - "end": { - "line": 571, - "column": 3, - "index": 15789 - } - }, - "context": { - "loc": { - "start": { - "line": 572, - "column": 2, - "index": 15792 - }, - "end": { - "line": 575, - "column": 3, - "index": 15852 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clearRows", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "clearRows", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#clearRows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "addColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to add a new column to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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.)" - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "title of the given column", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "title" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 577, - "column": 2, - "index": 15856 - }, - "end": { - "line": 619, - "column": 3, - "index": 17079 - } - }, - "context": { - "loc": { - "start": { - "line": 620, - "column": 2, - "index": 17082 - }, - "end": { - "line": 623, - "column": 3, - "index": 17160 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "title", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "title of the given column" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "addColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#addColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of columns in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of columns in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 625, - "column": 2, - "index": 17164 - }, - "end": { - "line": 655, - "column": 3, - "index": 17854 - } - }, - "context": { - "loc": { - "start": { - "line": 656, - "column": 2, - "index": 17857 - }, - "end": { - "line": 658, - "column": 3, - "index": 17912 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of columns in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getColumnCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getColumnCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getColumnCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the total number of rows in a Table." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": "Number of rows in this table", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 660, - "column": 2, - "index": 17916 - }, - "end": { - "line": 690, - "column": 3, - "index": 18564 - } - }, - "context": { - "loc": { - "start": { - "line": 691, - "column": 2, - "index": 18567 - }, - "end": { - "line": 693, - "column": 3, - "index": 18616 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Number of rows in this table" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getRowCount", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getRowCount", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getRowCount" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes any of the specified characters (or \"tokens\")." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "String listing characters to be removed", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "chars" - }, - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 695, - "column": 2, - "index": 18620 - }, - "end": { - "line": 730, - "column": 3, - "index": 19601 - } - }, - "context": { - "loc": { - "start": { - "line": 731, - "column": 2, - "index": 19604 - }, - "end": { - "line": 764, - "column": 3, - "index": 20779 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "chars", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String listing characters to be removed" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeTokens", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeTokens", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeTokens" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Column ID (number)\n or name (string)", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 766, - "column": 2, - "index": 20783 - }, - "end": { - "line": 798, - "column": 3, - "index": 21711 - } - }, - "context": { - "loc": { - "start": { - "line": 799, - "column": 2, - "index": 21714 - }, - "end": { - "line": 827, - "column": 3, - "index": 22666 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (number)\nor name (string)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "trim", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "trim", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#trim" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "removeColumn()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "columnName (string) or ID (number)", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 829, - "column": 2, - "index": 22670 - }, - "end": { - "line": 864, - "column": 3, - "index": 23691 - } - }, - "context": { - "loc": { - "start": { - "line": 865, - "column": 2, - "index": 23694 - }, - "end": { - "line": 888, - "column": 3, - "index": 24362 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "c", - "lineNumber": 865 - }, - { - "title": "param", - "name": "column", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or ID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "removeColumn", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "removeColumn", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#removeColumn" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 890, - "column": 2, - "index": 24366 - }, - "end": { - "line": 932, - "column": 3, - "index": 25518 - } - }, - "context": { - "loc": { - "start": { - "line": 933, - "column": 2, - "index": 25521 - }, - "end": { - "line": 935, - "column": 3, - "index": 25590 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "set", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "set", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#set" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 937, - "column": 2, - "index": 25594 - }, - "end": { - "line": 976, - "column": 3, - "index": 26578 - } - }, - "context": { - "loc": { - "start": { - "line": 977, - "column": 2, - "index": 26581 - }, - "end": { - "line": 979, - "column": 3, - "index": 26656 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "column ID (Number)\n or title (String)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "value to assign", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 981, - "column": 2, - "index": 26660 - }, - "end": { - "line": 1019, - "column": 3, - "index": 27767 - } - }, - "context": { - "loc": { - "start": { - "line": 1020, - "column": 2, - "index": 27770 - }, - "end": { - "line": 1022, - "column": 3, - "index": 27851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "column ID (Number)\nor title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "setString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "setString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#setString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1024, - "column": 2, - "index": 27855 - }, - "end": { - "line": 1062, - "column": 3, - "index": 28842 - } - }, - "context": { - "loc": { - "start": { - "line": 1063, - "column": 2, - "index": 28845 - }, - "end": { - "line": 1065, - "column": 3, - "index": 28907 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "get", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "get", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#get" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1067, - "column": 2, - "index": 28911 - }, - "end": { - "line": 1103, - "column": 3, - "index": 29853 - } - }, - "context": { - "loc": { - "start": { - "line": 1104, - "column": 2, - "index": 29856 - }, - "end": { - "line": 1106, - "column": 3, - "index": 29924 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getNum", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getNum", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "row ID", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "row" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1108, - "column": 2, - "index": 29928 - }, - "end": { - "line": 1151, - "column": 3, - "index": 31214 - } - }, - "context": { - "loc": { - "start": { - "line": 1153, - "column": 2, - "index": 31218 - }, - "end": { - "line": 1155, - "column": 3, - "index": 31292 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "row", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "row ID" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getString", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getString", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "param", - "description": "Name of the column which should be used to\n title each row object (optional)", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "headerColumn" - }, - { - "title": "return", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 1157, - "column": 2, - "index": 31296 - }, - "end": { - "line": 1195, - "column": 3, - "index": 32265 - } - }, - "context": { - "loc": { - "start": { - "line": 1196, - "column": 2, - "index": 32268 - }, - "end": { - "line": 1216, - "column": 3, - "index": 32851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "headerColumn", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Name of the column which should be used to\ntitle each row object (optional)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getObject", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getObject", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getObject" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves all table data and returns it as a multidimensional array." - } - ] - } - ] - }, - "tags": [ - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 1218, - "column": 2, - "index": 32855 - }, - "end": { - "line": 1251, - "column": 3, - "index": 33622 - } - }, - "context": { - "loc": { - "start": { - "line": 1252, - "column": 2, - "index": 33625 - }, - "end": { - "line": 1258, - "column": 3, - "index": 33788 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "getArray", - "kind": "function", - "memberof": "p5.Table", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - }, - { - "name": "getArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.Table#getArray" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "Table", - "scope": "static" - } - ], - "namespace": "p5.Table" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An internal class to store data that will be sent to a p5.RenderBuffer.\nThose need to eventually go into a Float32Array, so this class provides a\nvariable-length array container backed by a Float32Array so that it can be\nsent to the GPU without allocating a new array each frame." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Like a C++ vector, its fixed-length Float32Array backing its contents will\ndouble in size when it goes over its capacity." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 3, - "column": 0, - "index": 32 - }, - "end": { - "line": 27, - "column": 3, - "index": 926 - } - }, - "context": { - "loc": { - "start": { - "line": 28, - "column": 0, - "index": 927 - }, - "end": { - "line": 108, - "column": 2, - "index": 2998 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\n// Initialize storage with a capacity of 4\nconst storage = new DataArray(4);\nconsole.log(storage.data.length); // 4\nconsole.log(storage.length); // 0\nconsole.log(storage.dataArray()); // Empty Float32Array\n\nstorage.push(1, 2, 3, 4, 5, 6);\nconsole.log(storage.data.length); // 8\nconsole.log(storage.length); // 6\nconsole.log(storage.dataArray()); // Float32Array{1, 2, 3, 4, 5, 6}\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "DataArray", - "memberof": "p5", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a Float32Array window sized to the exact length of the data" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 35, - "column": 2, - "index": 1114 - }, - "end": { - "line": 37, - "column": 5, - "index": 1196 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 2, - "index": 1199 - }, - "end": { - "line": 40, - "column": 3, - "index": 1258 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dataArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "dataArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#dataArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A \"soft\" clear, which keeps the underlying storage size the same, but\nempties the contents of its dataArray()" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 42, - "column": 2, - "index": 1262 - }, - "end": { - "line": 45, - "column": 5, - "index": 1391 - } - }, - "context": { - "loc": { - "start": { - "line": 46, - "column": 2, - "index": 1394 - }, - "end": { - "line": 48, - "column": 3, - "index": 1428 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "clear", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "clear", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#clear" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Can be used to scale a DataArray back down to fit its contents." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 50, - "column": 2, - "index": 1432 - }, - "end": { - "line": 52, - "column": 5, - "index": 1510 - } - }, - "context": { - "loc": { - "start": { - "line": 53, - "column": 2, - "index": 1513 - }, - "end": { - "line": 61, - "column": 3, - "index": 1839 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rescale", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "rescale", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#rescale" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A full reset, which allocates a new underlying Float32Array at its initial\nlength" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 63, - "column": 2, - "index": 1843 - }, - "end": { - "line": 66, - "column": 5, - "index": 1944 - } - }, - "context": { - "loc": { - "start": { - "line": 67, - "column": 2, - "index": 1947 - }, - "end": { - "line": 70, - "column": 3, - "index": 2032 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "reset", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "reset", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#reset" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Adds values to the DataArray, expanding its internal storage to\naccommodate the new items." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 72, - "column": 2, - "index": 2036 - }, - "end": { - "line": 75, - "column": 5, - "index": 2146 - } - }, - "context": { - "loc": { - "start": { - "line": 76, - "column": 2, - "index": 2149 - }, - "end": { - "line": 80, - "column": 3, - "index": 2296 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "values", - "lineNumber": 76, - "type": { - "type": "RestType" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "push", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "push", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#push" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a copy of the data from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to the index\n" - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 82, - "column": 2, - "index": 2300 - }, - "end": { - "line": 85, - "column": 5, - "index": 2409 - } - }, - "context": { - "loc": { - "start": { - "line": 86, - "column": 2, - "index": 2412 - }, - "end": { - "line": 88, - "column": 3, - "index": 2494 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 86 - }, - { - "title": "param", - "name": "to", - "lineNumber": 86 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "slice", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "slice", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#slice" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a mutable Float32Array window from the index " - }, - { - "type": "inlineCode", - "value": "from" - }, - { - "type": "text", - "value": ", inclusive, to\nthe index " - }, - { - "type": "inlineCode", - "value": "to" - }, - { - "type": "text", - "value": ", exclusive" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 90, - "column": 2, - "index": 2498 - }, - "end": { - "line": 93, - "column": 5, - "index": 2618 - } - }, - "context": { - "loc": { - "start": { - "line": 94, - "column": 2, - "index": 2621 - }, - "end": { - "line": 96, - "column": 3, - "index": 2709 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "from", - "lineNumber": 94 - }, - { - "title": "param", - "name": "to", - "lineNumber": 94 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "subArray", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "subArray", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#subArray" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Expand capacity of the internal storage until it can fit a target size" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 98, - "column": 2, - "index": 2713 - }, - "end": { - "line": 100, - "column": 5, - "index": 2798 - } - }, - "context": { - "loc": { - "start": { - "line": 101, - "column": 2, - "index": 2801 - }, - "end": { - "line": 107, - "column": 3, - "index": 2995 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.DataArray.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "target", - "lineNumber": 101 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "ensureLength", - "kind": "function", - "memberof": "p5.DataArray", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - }, - { - "name": "ensureLength", - "kind": "function", - "scope": "instance" - } - ], - "namespace": "p5.DataArray#ensureLength" - } - ], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5" - }, - { - "name": "DataArray", - "scope": "static" - } - ], - "namespace": "p5.DataArray" - } - ] - }, - "path": [ - { - "name": "p5" - } - ], - "namespace": "p5" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Extracts the alpha (transparency) value from a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, array of color components, or\nCSS color string." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "alpha" - }, - { - "title": "param", - "description": "p5.Color object, array of\n color components, or CSS color string.", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "color" - }, - { - "title": "return", - "description": "the alpha value.", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 16, - "column": 0, - "index": 351 - }, - "end": { - "line": 40, - "column": 3, - "index": 1087 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 1088 - }, - "end": { - "line": 44, - "column": 2, - "index": 1207 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/creating_reading.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, array of\ncolor components, or CSS color string." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the alpha value." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "alpha", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "alpha", - "kind": "function" - } - ], - "namespace": "alpha" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Extracts the blue value from a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object,\narray of color components, or CSS color string." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "blue" - }, - { - "title": "param", - "description": "p5.Color object, array of\n color components, or CSS color string.", - "lineNumber": 5, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "color" - }, - { - "title": "return", - "description": "the blue value.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 46, - "column": 0, - "index": 1209 - }, - "end": { - "line": 68, - "column": 3, - "index": 1907 - } - }, - "context": { - "loc": { - "start": { - "line": 69, - "column": 0, - "index": 1908 - }, - "end": { - "line": 72, - "column": 2, - "index": 2024 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/creating_reading.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, array of\ncolor components, or CSS color string." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the blue value." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "blue", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "blue", - "kind": "function" - } - ], - "namespace": "blue" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Extracts the HSB brightness value from a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, array of color components, or\nCSS color string." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "brightness" - }, - { - "title": "param", - "description": "p5.Color object, array of\n color components, or CSS color string.", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "color" - }, - { - "title": "return", - "description": "the brightness value.", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 74, - "column": 0, - "index": 2026 - }, - "end": { - "line": 114, - "column": 3, - "index": 3160 - } - }, - "context": { - "loc": { - "start": { - "line": 115, - "column": 0, - "index": 3161 - }, - "end": { - "line": 118, - "column": 2, - "index": 3295 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/creating_reading.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, array of\ncolor components, or CSS color string." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the brightness value." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "brightness", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "brightness", - "kind": "function" - } - ], - "namespace": "brightness" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object. By default, the\nparameters are interpreted as RGB values. Calling " - }, - { - "type": "inlineCode", - "value": "color(255, 204, 0)" - }, - { - "type": "text", - "value": " will\nreturn a bright yellow color. The way these parameters are interpreted may\nbe changed with the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "colorMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "color()" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "color()" - }, - { - "type": "text", - "value": " with two parameters interprets the first one as a\ngrayscale value. The second parameter sets the alpha (transparency) value." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "color()" - }, - { - "type": "text", - "value": " with three parameters interprets them as RGB, HSB,\nor HSL colors, depending on the current " - }, - { - "type": "inlineCode", - "value": "colorMode()" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "color()" - }, - { - "type": "text", - "value": " with four parameters interprets them as RGBA, HSBA,\nor HSLA colors, depending on the current " - }, - { - "type": "inlineCode", - "value": "colorMode()" - }, - { - "type": "text", - "value": ". The last parameter\nsets the alpha (transparency) value." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 20, - "name": "color" - }, - { - "title": "param", - "description": "number specifying value between white and black.", - "lineNumber": 21, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "gray" - }, - { - "title": "param", - "description": "alpha value relative to current color range\n (default is 0-255).", - "lineNumber": 22, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "alpha" - }, - { - "title": "return", - "description": "resulting color.", - "lineNumber": 24, - "type": { - "type": "NameExpression", - "name": "p5.Color" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 26 - } - ], - "loc": { - "start": { - "line": 120, - "column": 0, - "index": 3297 - }, - "end": { - "line": 261, - "column": 3, - "index": 7098 - } - }, - "context": { - "loc": { - "start": { - "line": 293, - "column": 0, - "index": 7945 - }, - "end": { - "line": 301, - "column": 2, - "index": 8260 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/creating_reading.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "gray", - "lineNumber": 21, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number specifying value between white and black." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "alpha", - "lineNumber": 22, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "alpha value relative to current color range\n(default is 0-255)." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "resulting color." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Color" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "color", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "color", - "kind": "function" - } - ], - "namespace": "color" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "color" - }, - { - "title": "param", - "description": "red or hue value relative to\n the current color range.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v1" - }, - { - "title": "param", - "description": "green or saturation value\n relative to the current color range.", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v2" - }, - { - "title": "param", - "description": "blue or brightness value\n relative to the current color range.", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v3" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "alpha" - }, - { - "title": "return", - "description": null, - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "p5.Color" - } - } - ], - "loc": { - "start": { - "line": 263, - "column": 0, - "index": 7100 - }, - "end": { - "line": 273, - "column": 3, - "index": 7570 - } - }, - "context": { - "loc": { - "start": { - "line": 293, - "column": 0, - "index": 7945 - }, - "end": { - "line": 301, - "column": 2, - "index": 8260 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/creating_reading.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "red or hue value relative to\nthe current color range." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "green or saturation value\nrelative to the current color range." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v3", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "blue or brightness value\nrelative to the current color range." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "alpha", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Color" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "color", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "color", - "kind": "function" - } - ], - "namespace": "color" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "color" - }, - { - "title": "param", - "description": "a color string.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Color" - } - } - ], - "loc": { - "start": { - "line": 275, - "column": 0, - "index": 7572 - }, - "end": { - "line": 279, - "column": 3, - "index": 7669 - } - }, - "context": { - "loc": { - "start": { - "line": 293, - "column": 0, - "index": 7945 - }, - "end": { - "line": 301, - "column": 2, - "index": 8260 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/creating_reading.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a color string." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Color" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "color", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "color", - "kind": "function" - } - ], - "namespace": "color" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "color" - }, - { - "title": "param", - "description": "an array containing the red, green, blue,\n and alpha components of the color.", - "lineNumber": 2, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "values" - }, - { - "title": "return", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "p5.Color" - } - } - ], - "loc": { - "start": { - "line": 281, - "column": 0, - "index": 7671 - }, - "end": { - "line": 286, - "column": 3, - "index": 7864 - } - }, - "context": { - "loc": { - "start": { - "line": 293, - "column": 0, - "index": 7945 - }, - "end": { - "line": 301, - "column": 2, - "index": 8260 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/creating_reading.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "values", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "an array containing the red, green, blue,\nand alpha components of the color." - } - ] - } - ] - }, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Color" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "color", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "color", - "kind": "function" - } - ], - "namespace": "color" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "color" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Color" - }, - "name": "color" - }, - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Color" - } - } - ], - "loc": { - "start": { - "line": 288, - "column": 0, - "index": 7866 - }, - "end": { - "line": 292, - "column": 3, - "index": 7944 - } - }, - "context": { - "loc": { - "start": { - "line": 293, - "column": 0, - "index": 7945 - }, - "end": { - "line": 301, - "column": 2, - "index": 8260 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/creating_reading.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Color" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Color" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "color", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "color", - "kind": "function" - } - ], - "namespace": "color" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Extracts the green value from a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object,\narray of color components, or CSS color string." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "green" - }, - { - "title": "param", - "description": "p5.Color object, array of\n color components, or CSS color string.", - "lineNumber": 5, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "color" - }, - { - "title": "return", - "description": "the green value.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 303, - "column": 0, - "index": 8262 - }, - "end": { - "line": 324, - "column": 3, - "index": 8968 - } - }, - "context": { - "loc": { - "start": { - "line": 325, - "column": 0, - "index": 8969 - }, - "end": { - "line": 328, - "column": 2, - "index": 9088 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/creating_reading.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, array of\ncolor components, or CSS color string." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the green value." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "green", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "green", - "kind": "function" - } - ], - "namespace": "green" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Extracts the hue value from a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, array of color components, or\nCSS color string." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "colorMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is set to HSB, it returns the\nHSB-normalized hue." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 10, - "name": "hue" - }, - { - "title": "param", - "description": "p5.Color object, array of\n color components, or CSS color string.", - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "color" - }, - { - "title": "return", - "description": "the hue", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 330, - "column": 0, - "index": 9090 - }, - "end": { - "line": 362, - "column": 3, - "index": 10082 - } - }, - "context": { - "loc": { - "start": { - "line": 363, - "column": 0, - "index": 10083 - }, - "end": { - "line": 366, - "column": 2, - "index": 10196 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/creating_reading.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, array of\ncolor components, or CSS color string." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the hue" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "hue", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "hue", - "kind": "function" - } - ], - "namespace": "hue" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Blends two colors to find a third color between them. The " - }, - { - "type": "inlineCode", - "value": "amt" - }, - { - "type": "text", - "value": " 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\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "lerp" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". It's necessary because numbers outside of the\ninterval [0, 1] will produce strange and unexpected colors." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The way that colors are interpolated depends on the current\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "colorMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 12, - "name": "lerpColor" - }, - { - "title": "param", - "description": "interpolate from this color.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "p5.Color" - }, - "name": "c1" - }, - { - "title": "param", - "description": "interpolate to this color.", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "p5.Color" - }, - "name": "c2" - }, - { - "title": "param", - "description": "number between 0 and 1.", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "amt" - }, - { - "title": "return", - "description": "interpolated color.", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "p5.Color" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 18 - } - ], - "loc": { - "start": { - "line": 368, - "column": 0, - "index": 10198 - }, - "end": { - "line": 410, - "column": 3, - "index": 11637 - } - }, - "context": { - "loc": { - "start": { - "line": 411, - "column": 0, - "index": 11638 - }, - "end": { - "line": 466, - "column": 2, - "index": 13282 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/creating_reading.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "c1", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "interpolate from this color." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Color" - } - }, - { - "title": "param", - "name": "c2", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "interpolate to this color." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Color" - } - }, - { - "title": "param", - "name": "amt", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number between 0 and 1." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "interpolated color." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Color" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "lerpColor", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "lerpColor", - "kind": "function" - } - ], - "namespace": "lerpColor" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Extracts the HSL lightness value from a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, array of color components, or\nCSS color string." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "lightness" - }, - { - "title": "param", - "description": "p5.Color object, array of\n color components, or CSS color string.", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "color" - }, - { - "title": "return", - "description": "the lightness", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 468, - "column": 0, - "index": 13284 - }, - "end": { - "line": 493, - "column": 3, - "index": 14047 - } - }, - "context": { - "loc": { - "start": { - "line": 494, - "column": 0, - "index": 14048 - }, - "end": { - "line": 497, - "column": 2, - "index": 14179 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/creating_reading.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, array of\ncolor components, or CSS color string." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the lightness" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "lightness", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "lightness", - "kind": "function" - } - ], - "namespace": "lightness" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Extracts the red value from a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, array of color components, or\nCSS color string." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "red" - }, - { - "title": "param", - "description": "p5.Color object, array of\n color components, or CSS color string.", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "color" - }, - { - "title": "return", - "description": "the red value.", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 499, - "column": 0, - "index": 14181 - }, - "end": { - "line": 523, - "column": 3, - "index": 14904 - } - }, - "context": { - "loc": { - "start": { - "line": 524, - "column": 0, - "index": 14905 - }, - "end": { - "line": 527, - "column": 2, - "index": 15018 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/creating_reading.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, array of\ncolor components, or CSS color string." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the red value." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "red", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "red", - "kind": "function" - } - ], - "namespace": "red" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Extracts the saturation value from a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, array of color components, or\nCSS color string." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Saturation is scaled differently in HSB and HSL. By default, this function\nreturns the HSL saturation. If the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "colorMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nis set to HSB, it returns the HSB saturation." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "saturation" - }, - { - "title": "param", - "description": "p5.Color object, array of\n color components, or CSS color string.", - "lineNumber": 10, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "color" - }, - { - "title": "return", - "description": "the saturation value", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 529, - "column": 0, - "index": 15020 - }, - "end": { - "line": 559, - "column": 3, - "index": 15996 - } - }, - "context": { - "loc": { - "start": { - "line": 560, - "column": 0, - "index": 15997 - }, - "end": { - "line": 563, - "column": 2, - "index": 16131 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/creating_reading.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, array of\ncolor components, or CSS color string." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the saturation value" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "saturation", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "saturation", - "kind": "function" - } - ], - "namespace": "saturation" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A class to describe a color. Each " - }, - { - "type": "inlineCode", - "value": "p5.Color" - }, - { - "type": "text", - "value": " 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\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "saturation()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is called." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When different color representations are calculated, the results are cached\nfor performance. These values are normalized, floating-point numbers." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "color()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is the recommended way to create an instance\nof this class." - } - ] - } - ] - }, - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 18, - "type": null, - "name": "p5.Color" - }, - { - "title": "param", - "description": "pointer to p5 instance.", - "lineNumber": 19, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5" - } - }, - "name": "pInst" - }, - { - "title": "param", - "description": "an array containing the color values\n for red, green, blue and alpha channel\n or CSS color.", - "lineNumber": 21, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "vals" - } - ], - "loc": { - "start": { - "line": 320, - "column": 0, - "index": 7287 - }, - "end": { - "line": 344, - "column": 3, - "index": 8465 - } - }, - "context": { - "loc": { - "start": { - "line": 345, - "column": 0, - "index": 8466 - }, - "end": { - "line": 1010, - "column": 2, - "index": 28102 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/p5.Color.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "pInst", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pointer to p5 instance." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5" - } - } - }, - { - "title": "param", - "name": "vals", - "lineNumber": 21, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "an array containing the color values\nfor red, green, blue and alpha channel\nor CSS color." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "class", - "name": "p5.Color", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.Color", - "kind": "class" - } - ], - "namespace": "p5.Color" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "For HSB and HSL, interpret the gray level as a brightness/lightness\nvalue (they are equivalent when chroma is zero). For RGB, normalize the\ngray level according to the blue maximum." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 986, - "column": 6, - "index": 27363 - }, - "end": { - "line": 990, - "column": 9, - "index": 27585 - } - }, - "context": { - "loc": { - "start": { - "line": 991, - "column": 6, - "index": 27592 - }, - "end": { - "line": 991, - "column": 32, - "index": 27618 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/p5.Color.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "results", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "results" - } - ], - "namespace": "results" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endClip()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " will\ncontribute to the mask shape." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "push()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Alternatively, rather than drawing the mask between this and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endClip()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", draw the mask in a callback function\npassed to " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "clip()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Options can include:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "invert" - }, - { - "type": "text", - "value": ": A boolean specifying whether or not to mask the areas " - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "not" - } - ] - }, - { - "type": "text", - "value": " filled by the mask shape. Defaults to false." - } - ] - } - ] - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 17, - "name": "beginClip" - }, - { - "title": "param", - "description": "An object containing clip settings.", - "lineNumber": 18, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - }, - "name": "options" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 20 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 51 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 55 - }, - { - "title": "alt", - "description": "A silhouette of a rotating torus colored with a gradient from\ncyan to purple", - "lineNumber": 87 - } - ], - "loc": { - "start": { - "line": 13, - "column": 0, - "index": 201 - }, - "end": { - "line": 103, - "column": 3, - "index": 2418 - } - }, - "context": { - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 2419 - }, - "end": { - "line": 106, - "column": 2, - "index": 2508 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - }, - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "options", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An object containing clip settings." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "beginClip", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "beginClip", - "kind": "function" - } - ], - "namespace": "beginClip" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginClip()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and this\nwill contribute to the mask shape." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "endClip" - } - ], - "loc": { - "start": { - "line": 108, - "column": 0, - "index": 2510 - }, - "end": { - "line": 115, - "column": 3, - "index": 2811 - } - }, - "context": { - "loc": { - "start": { - "line": 116, - "column": 0, - "index": 2812 - }, - "end": { - "line": 118, - "column": 2, - "index": 2878 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "endClip", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "endClip", - "kind": "function" - } - ], - "namespace": "endClip" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "push()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Alternatively, rather than drawing the mask shape in a function, draw the\nshape between " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginClip()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endClip()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Options can include:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "invert" - }, - { - "type": "text", - "value": ": A boolean specifying whether or not to mask the areas " - }, - { - "type": "emphasis", - "children": [ - { - "type": "text", - "value": "not" - } - ] - }, - { - "type": "text", - "value": " filled by the mask shape. Defaults to false." - } - ] - } - ] - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 14, - "name": "clip" - }, - { - "title": "param", - "description": "A function that draws the mask shape.", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Function" - }, - "name": "callback" - }, - { - "title": "param", - "description": "An object containing clip settings.", - "lineNumber": 16, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - }, - "name": "options" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 18 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 49 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 53 - }, - { - "title": "alt", - "description": "A silhouette of a rotating torus colored with a gradient from\ncyan to purple", - "lineNumber": 85 - } - ], - "loc": { - "start": { - "line": 120, - "column": 0, - "index": 2880 - }, - "end": { - "line": 208, - "column": 3, - "index": 5052 - } - }, - "context": { - "loc": { - "start": { - "line": 209, - "column": 0, - "index": 5053 - }, - "end": { - "line": 213, - "column": 2, - "index": 5191 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - }, - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "callback", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A function that draws the mask shape." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Function" - } - }, - { - "title": "param", - "name": "options", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An object containing clip settings." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "clip", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "clip", - "kind": "function" - } - ], - "namespace": "clip" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the color used for the background of the canvas. By default, the\nbackground is transparent. This function is typically used within\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to clear the display window at the beginning\nof each frame. It can also be used inside " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to\nset the background on the first frame of animation." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "background()" - }, - { - "type": "text", - "value": " 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\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, it will be used as the background color.\nIf the parameter is a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, it will be used as\nthe background image." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "background()" - }, - { - "type": "text", - "value": " with two parameters interprets the first one as a\ngrayscale value. The second parameter sets the alpha (transparency) value." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "background()" - }, - { - "type": "text", - "value": " with three parameters interprets them as RGB, HSB,\nor HSL colors, depending on the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "colorMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nBy default, colors are specified in RGB values. Calling background(255, 204, 0)\nsets the background a bright yellow color." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 23, - "name": "background" - }, - { - "title": "param", - "description": "any value created by the color() function", - "lineNumber": 24, - "type": { - "type": "NameExpression", - "name": "p5.Color" - }, - "name": "color" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 25 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 215, - "column": 0, - "index": 5193 - }, - "end": { - "line": 341, - "column": 3, - "index": 8641 - } - }, - "context": { - "loc": { - "start": { - "line": 385, - "column": 0, - "index": 10091 - }, - "end": { - "line": 388, - "column": 2, - "index": 10192 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 24, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "any value created by the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "color()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Color" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "background", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "background", - "kind": "function" - } - ], - "namespace": "background" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "background" - }, - { - "title": "param", - "description": "color string, possible formats include: integer\n rgb() or rgba(), percentage rgb() or rgba(),\n 3-digit hex, 6-digit hex.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "colorstring" - }, - { - "title": "param", - "description": "opacity of the background relative to current\n color range (default is 0-255).", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "a" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 343, - "column": 0, - "index": 8643 - }, - "end": { - "line": 351, - "column": 3, - "index": 9030 - } - }, - "context": { - "loc": { - "start": { - "line": 385, - "column": 0, - "index": 10091 - }, - "end": { - "line": 388, - "column": 2, - "index": 10192 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "colorstring", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "color string, possible formats include: integer\nrgb() or rgba(), percentage rgb() or rgba(),\n3-digit hex, 6-digit hex." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "a", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "opacity of the background relative to current\ncolor range (default is 0-255)." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "background", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "background", - "kind": "function" - } - ], - "namespace": "background" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "background" - }, - { - "title": "param", - "description": "specifies a value between white and black.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "gray" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "a" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 353, - "column": 0, - "index": 9032 - }, - "end": { - "line": 358, - "column": 3, - "index": 9167 - } - }, - "context": { - "loc": { - "start": { - "line": 385, - "column": 0, - "index": 10091 - }, - "end": { - "line": 388, - "column": 2, - "index": 10192 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "gray", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "specifies a value between white and black." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "a", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "background", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "background", - "kind": "function" - } - ], - "namespace": "background" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "background" - }, - { - "title": "param", - "description": "red value if color mode is RGB, or hue value if color mode is HSB.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v1" - }, - { - "title": "param", - "description": "green value if color mode is RGB, or saturation value if color mode is HSB.", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v2" - }, - { - "title": "param", - "description": "blue value if color mode is RGB, or brightness value if color mode is HSB.", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v3" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "a" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 360, - "column": 0, - "index": 9169 - }, - "end": { - "line": 367, - "column": 3, - "index": 9532 - } - }, - "context": { - "loc": { - "start": { - "line": 385, - "column": 0, - "index": 10091 - }, - "end": { - "line": 388, - "column": 2, - "index": 10192 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "red value if color mode is RGB, or hue value if color mode is HSB." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "green value if color mode is RGB, or saturation value if color mode is HSB." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v3", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "blue value if color mode is RGB, or brightness value if color mode is HSB." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "a", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "background", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "background", - "kind": "function" - } - ], - "namespace": "background" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "background" - }, - { - "title": "param", - "description": "an array containing the red, green, blue\n and alpha components of the color.", - "lineNumber": 2, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "values" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 369, - "column": 0, - "index": 9534 - }, - "end": { - "line": 374, - "column": 3, - "index": 9723 - } - }, - "context": { - "loc": { - "start": { - "line": 385, - "column": 0, - "index": 10091 - }, - "end": { - "line": 388, - "column": 2, - "index": 10192 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "values", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "an array containing the red, green, blue\nand alpha components of the color." - } - ] - } - ] - }, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "background", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "background", - "kind": "function" - } - ], - "namespace": "background" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "background" - }, - { - "title": "param", - "description": "image created with loadImage()\n or createImage(),\n to set as background.\n (must be same size as the sketch window).", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Image" - }, - "name": "image" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "a" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 376, - "column": 0, - "index": 9725 - }, - "end": { - "line": 384, - "column": 3, - "index": 10090 - } - }, - "context": { - "loc": { - "start": { - "line": 385, - "column": 0, - "index": 10091 - }, - "end": { - "line": 388, - "column": 2, - "index": 10192 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "image", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "image created with " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadImage()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nor " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createImage()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\nto set as background.\n(must be same size as the sketch window)." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Image" - } - }, - { - "title": "param", - "name": "a", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "background", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "background", - "kind": "function" - } - ], - "namespace": "background" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Clears the pixels on the canvas. This function makes every pixel 100%\ntransparent. Calling " - }, - { - "type": "inlineCode", - "value": "clear()" - }, - { - "type": "text", - "value": " doesn't clear objects created by " - }, - { - "type": "inlineCode", - "value": "createX()" - }, - { - "type": "text", - "value": "\nfunctions such as " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createGraphics()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createVideo()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createImg()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". These objects will remain\nunchanged after calling clear() and can be redrawn." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 13, - "name": "clear" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 14 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 15 - }, - { - "title": "param", - "description": "normalized red value.", - "lineNumber": 54, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "r" - }, - { - "title": "param", - "description": "normalized green value.", - "lineNumber": 55, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "g" - }, - { - "title": "param", - "description": "normalized blue value.", - "lineNumber": 56, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "b" - }, - { - "title": "param", - "description": "normalized alpha value.", - "lineNumber": 57, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "a" - } - ], - "loc": { - "start": { - "line": 390, - "column": 0, - "index": 10194 - }, - "end": { - "line": 448, - "column": 3, - "index": 11897 - } - }, - "context": { - "loc": { - "start": { - "line": 449, - "column": 0, - "index": 11898 - }, - "end": { - "line": 457, - "column": 2, - "index": 12105 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "r", - "lineNumber": 54, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "normalized red value." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "g", - "lineNumber": 55, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "normalized green value." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "b", - "lineNumber": 56, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "normalized blue value." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "a", - "lineNumber": 57, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "normalized alpha value." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "clear", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "clear", - "kind": "function" - } - ], - "namespace": "clear" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Clears the data already written to the PrintWriter object" - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 2, - "name": "clear" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 1268, - "column": 2, - "index": 38049 - }, - "end": { - "line": 1298, - "column": 5, - "index": 38789 - } - }, - "context": { - "loc": { - "start": { - "line": 1299, - "column": 2, - "index": 38792 - }, - "end": { - "line": 1301, - "column": 4, - "index": 38845 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "clear", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "clear", - "kind": "function" - } - ], - "namespace": "clear" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Changes the way p5.js interprets color data. By default, the numeric\nparameters for " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "fill()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "stroke()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "background()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "color()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " are defined by values between 0 and 255\nusing the RGB color model. This is equivalent to calling\n" - }, - { - "type": "inlineCode", - "value": "colorMode(RGB, 255)" - }, - { - "type": "text", - "value": ". Pure red is " - }, - { - "type": "inlineCode", - "value": "color(255, 0, 0)" - }, - { - "type": "text", - "value": " in this model." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "inlineCode", - "value": "colorMode(RGB, 100)" - }, - { - "type": "text", - "value": " sets colors to be interpreted as RGB color\nvalues between 0 and 100. Pure red is " - }, - { - "type": "inlineCode", - "value": "color(100, 0, 0)" - }, - { - "type": "text", - "value": " in this model." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "inlineCode", - "value": "colorMode(HSB)" - }, - { - "type": "text", - "value": " or " - }, - { - "type": "inlineCode", - "value": "colorMode(HSL)" - }, - { - "type": "text", - "value": " changes to HSB or HSL system\ninstead of RGB." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " objects remember the mode that they were\ncreated in. Changing modes doesn't affect their appearance." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 18, - "name": "colorMode" - }, - { - "title": "param", - "description": "either RGB, HSB or HSL, corresponding to\n Red/Green/Blue and Hue/Saturation/Brightness\n (or Lightness).", - "lineNumber": 19, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "RGB" - }, - { - "type": "NameExpression", - "name": "HSB" - }, - { - "type": "NameExpression", - "name": "HSL" - } - ] - }, - "name": "mode" - }, - { - "title": "param", - "description": "range for all values.", - "lineNumber": 22, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "max" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 23 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 459, - "column": 0, - "index": 12107 - }, - "end": { - "line": 544, - "column": 3, - "index": 14670 - } - }, - "context": { - "loc": { - "start": { - "line": 558, - "column": 0, - "index": 15188 - }, - "end": { - "line": 588, - "column": 2, - "index": 16009 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "mode", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either RGB, HSB or HSL, corresponding to\nRed/Green/Blue and Hue/Saturation/Brightness\n(or Lightness)." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "RGB" - }, - { - "type": "NameExpression", - "name": "HSB" - }, - { - "type": "NameExpression", - "name": "HSL" - } - ] - } - }, - { - "title": "param", - "name": "max", - "lineNumber": 22, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "range for all values." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "colorMode", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "colorMode", - "kind": "function" - } - ], - "namespace": "colorMode" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "colorMode" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "RGB" - }, - { - "type": "NameExpression", - "name": "HSB" - }, - { - "type": "NameExpression", - "name": "HSL" - } - ] - }, - "name": "mode" - }, - { - "title": "param", - "description": "range for the red or hue depending on the\n current color mode.", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "max1" - }, - { - "title": "param", - "description": "range for the green or saturation depending\n on the current color mode.", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "max2" - }, - { - "title": "param", - "description": "range for the blue or brightness/lightness\n depending on the current color mode.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "max3" - }, - { - "title": "param", - "description": "range for the alpha.", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "maxA" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 546, - "column": 0, - "index": 14672 - }, - "end": { - "line": 557, - "column": 3, - "index": 15187 - } - }, - "context": { - "loc": { - "start": { - "line": 558, - "column": 0, - "index": 15188 - }, - "end": { - "line": 588, - "column": 2, - "index": 16009 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "mode", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "RGB" - }, - { - "type": "NameExpression", - "name": "HSB" - }, - { - "type": "NameExpression", - "name": "HSL" - } - ] - } - }, - { - "title": "param", - "name": "max1", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "range for the red or hue depending on the\ncurrent color mode." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "max2", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "range for the green or saturation depending\non the current color mode." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "max3", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "range for the blue or brightness/lightness\ndepending on the current color mode." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "maxA", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "range for the alpha." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "colorMode", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "colorMode", - "kind": "function" - } - ], - "namespace": "colorMode" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the color used to fill shapes. Calling " - }, - { - "type": "inlineCode", - "value": "fill(255, 165, 0)" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "inlineCode", - "value": "fill('orange')" - }, - { - "type": "text", - "value": " means all shapes drawn after the fill command will be\nfilled with the color orange." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "fill()" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object can also be provided to\nset the fill color." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "fill()" - }, - { - "type": "text", - "value": " with three parameters interprets them as RGB, HSB,\nor HSL colors, depending on the current\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "colorMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". The default color space is RGB,\nwith each value in the range from 0 to 255." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 16, - "name": "fill" - }, - { - "title": "param", - "description": "red value if color mode is RGB or hue value if color mode is HSB.", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v1" - }, - { - "title": "param", - "description": "green value if color mode is RGB or saturation value if color mode is HSB.", - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v2" - }, - { - "title": "param", - "description": "blue value if color mode is RGB or brightness value if color mode is HSB.", - "lineNumber": 19, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v3" - }, - { - "title": "param", - "description": null, - "lineNumber": 20, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "alpha" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 21 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 590, - "column": 0, - "index": 16011 - }, - "end": { - "line": 713, - "column": 3, - "index": 19135 - } - }, - "context": { - "loc": { - "start": { - "line": 740, - "column": 0, - "index": 19630 - }, - "end": { - "line": 745, - "column": 2, - "index": 19816 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "red value if color mode is RGB or hue value if color mode is HSB." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "green value if color mode is RGB or saturation value if color mode is HSB." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v3", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "blue value if color mode is RGB or brightness value if color mode is HSB." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "alpha", - "lineNumber": 20, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "fill", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "fill", - "kind": "function" - } - ], - "namespace": "fill" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "fill" - }, - { - "title": "param", - "description": "a color string.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 715, - "column": 0, - "index": 19137 - }, - "end": { - "line": 719, - "column": 3, - "index": 19225 - } - }, - "context": { - "loc": { - "start": { - "line": 740, - "column": 0, - "index": 19630 - }, - "end": { - "line": 745, - "column": 2, - "index": 19816 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a color string." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "fill", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "fill", - "kind": "function" - } - ], - "namespace": "fill" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "fill" - }, - { - "title": "param", - "description": "a grayscale value.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "gray" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "alpha" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 721, - "column": 0, - "index": 19227 - }, - "end": { - "line": 726, - "column": 3, - "index": 19352 - } - }, - "context": { - "loc": { - "start": { - "line": 740, - "column": 0, - "index": 19630 - }, - "end": { - "line": 745, - "column": 2, - "index": 19816 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "gray", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a grayscale value." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "alpha", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "fill", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "fill", - "kind": "function" - } - ], - "namespace": "fill" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "fill" - }, - { - "title": "param", - "description": "an array containing the red, green, blue &\n and alpha components of the color.", - "lineNumber": 2, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "values" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 728, - "column": 0, - "index": 19354 - }, - "end": { - "line": 733, - "column": 3, - "index": 19539 - } - }, - "context": { - "loc": { - "start": { - "line": 740, - "column": 0, - "index": 19630 - }, - "end": { - "line": 745, - "column": 2, - "index": 19816 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "values", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "an array containing the red, green, blue &\nand alpha components of the color." - } - ] - } - ] - }, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "fill", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "fill", - "kind": "function" - } - ], - "namespace": "fill" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "fill" - }, - { - "title": "param", - "description": "the fill color.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Color" - }, - "name": "color" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 735, - "column": 0, - "index": 19541 - }, - "end": { - "line": 739, - "column": 3, - "index": 19629 - } - }, - "context": { - "loc": { - "start": { - "line": 740, - "column": 0, - "index": 19630 - }, - "end": { - "line": 745, - "column": 2, - "index": 19816 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the fill color." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Color" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "fill", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "fill", - "kind": "function" - } - ], - "namespace": "fill" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Disables setting the interior color of shapes. This is the same as making\nthe fill completely transparent. If both\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noStroke()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noFill()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " are called, nothing will be drawn to the\nscreen." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 7, - "name": "noFill" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 747, - "column": 0, - "index": 19818 - }, - "end": { - "line": 783, - "column": 3, - "index": 20694 - } - }, - "context": { - "loc": { - "start": { - "line": 784, - "column": 0, - "index": 20695 - }, - "end": { - "line": 787, - "column": 2, - "index": 20796 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "noFill", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "noFill", - "kind": "function" - } - ], - "namespace": "noFill" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Disables drawing the stroke (outline). If both\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noStroke()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noFill()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " are called, nothing will be drawn to the\nscreen." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "noStroke" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 789, - "column": 0, - "index": 20798 - }, - "end": { - "line": 823, - "column": 3, - "index": 21550 - } - }, - "context": { - "loc": { - "start": { - "line": 824, - "column": 0, - "index": 21551 - }, - "end": { - "line": 827, - "column": 2, - "index": 21656 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "noStroke", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "noStroke", - "kind": "function" - } - ], - "namespace": "noStroke" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the color used to draw lines and borders around shapes. Calling\n" - }, - { - "type": "inlineCode", - "value": "stroke(255, 165, 0)" - }, - { - "type": "text", - "value": " or " - }, - { - "type": "inlineCode", - "value": "stroke('orange')" - }, - { - "type": "text", - "value": " means all shapes drawn after\nthe " - }, - { - "type": "inlineCode", - "value": "stroke()" - }, - { - "type": "text", - "value": " command will be filled with the color orange. The way these\nparameters are interpreted may be changed with the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "colorMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "stroke()" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object can also be provided to\nset the stroke color." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "stroke()" - }, - { - "type": "text", - "value": " with two parameters interprets the first one as a\ngrayscale value. The second parameter sets the alpha (transparency) value." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "stroke()" - }, - { - "type": "text", - "value": " with three parameters interprets them as RGB, HSB,\nor HSL colors, depending on the current " - }, - { - "type": "inlineCode", - "value": "colorMode()" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "stroke()" - }, - { - "type": "text", - "value": " with four parameters interprets them as RGBA, HSBA,\nor HSLA colors, depending on the current " - }, - { - "type": "inlineCode", - "value": "colorMode()" - }, - { - "type": "text", - "value": ". The last parameter\nsets the alpha (transparency) value." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 23, - "name": "stroke" - }, - { - "title": "param", - "description": "red value if color mode is RGB or hue value if color mode is HSB.", - "lineNumber": 24, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v1" - }, - { - "title": "param", - "description": "green value if color mode is RGB or saturation value if color mode is HSB.", - "lineNumber": 25, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v2" - }, - { - "title": "param", - "description": "blue value if color mode is RGB or brightness value if color mode is HSB.", - "lineNumber": 26, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v3" - }, - { - "title": "param", - "description": null, - "lineNumber": 27, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "alpha" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 28 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 30 - } - ], - "loc": { - "start": { - "line": 829, - "column": 0, - "index": 21658 - }, - "end": { - "line": 970, - "column": 3, - "index": 25483 - } - }, - "context": { - "loc": { - "start": { - "line": 998, - "column": 0, - "index": 25988 - }, - "end": { - "line": 1003, - "column": 2, - "index": 26182 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 24, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "red value if color mode is RGB or hue value if color mode is HSB." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 25, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "green value if color mode is RGB or saturation value if color mode is HSB." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v3", - "lineNumber": 26, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "blue value if color mode is RGB or brightness value if color mode is HSB." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "alpha", - "lineNumber": 27, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "stroke", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "stroke", - "kind": "function" - } - ], - "namespace": "stroke" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "stroke" - }, - { - "title": "param", - "description": "a color string.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 972, - "column": 0, - "index": 25485 - }, - "end": { - "line": 976, - "column": 3, - "index": 25575 - } - }, - "context": { - "loc": { - "start": { - "line": 998, - "column": 0, - "index": 25988 - }, - "end": { - "line": 1003, - "column": 2, - "index": 26182 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a color string." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "stroke", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "stroke", - "kind": "function" - } - ], - "namespace": "stroke" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "stroke" - }, - { - "title": "param", - "description": "a grayscale value.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "gray" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "alpha" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 978, - "column": 0, - "index": 25577 - }, - "end": { - "line": 983, - "column": 3, - "index": 25704 - } - }, - "context": { - "loc": { - "start": { - "line": 998, - "column": 0, - "index": 25988 - }, - "end": { - "line": 1003, - "column": 2, - "index": 26182 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "gray", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a grayscale value." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "alpha", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "stroke", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "stroke", - "kind": "function" - } - ], - "namespace": "stroke" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "stroke" - }, - { - "title": "param", - "description": "an array containing the red, green, blue,\n and alpha components of the color.", - "lineNumber": 2, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "values" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 985, - "column": 0, - "index": 25706 - }, - "end": { - "line": 990, - "column": 3, - "index": 25892 - } - }, - "context": { - "loc": { - "start": { - "line": 998, - "column": 0, - "index": 25988 - }, - "end": { - "line": 1003, - "column": 2, - "index": 26182 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "values", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "an array containing the red, green, blue,\nand alpha components of the color." - } - ] - } - ] - }, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "stroke", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "stroke", - "kind": "function" - } - ], - "namespace": "stroke" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "stroke" - }, - { - "title": "param", - "description": "the stroke color.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Color" - }, - "name": "color" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 992, - "column": 0, - "index": 25894 - }, - "end": { - "line": 996, - "column": 3, - "index": 25986 - } - }, - "context": { - "loc": { - "start": { - "line": 998, - "column": 0, - "index": 25988 - }, - "end": { - "line": 1003, - "column": 2, - "index": 26182 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the stroke color." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Color" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "stroke", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "stroke", - "kind": "function" - } - ], - "namespace": "stroke" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "All drawing that follows " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "erase()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "fill()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "stroke()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "blendMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " have no effect once " - }, - { - "type": "inlineCode", - "value": "erase()" - }, - { - "type": "text", - "value": " is\ncalled." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "inlineCode", - "value": "erase()" - }, - { - "type": "text", - "value": " 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)." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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)." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "To cancel the erasing effect, use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noErase()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfunction." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "erase()" - }, - { - "type": "text", - "value": " has no effect on drawing done with the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "image()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "background()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " functions." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 26, - "name": "erase" - }, - { - "title": "param", - "description": "a number (0-255) for the strength of erasing under a shape's interior.\n Defaults to 255, which is full strength.", - "lineNumber": 27, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "strengthFill" - }, - { - "title": "param", - "description": "a number (0-255) for the strength of erasing under a shape's edge.\n Defaults to 255, which is full strength.", - "lineNumber": 29, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "strengthStroke" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 32 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 33 - } - ], - "loc": { - "start": { - "line": 1005, - "column": 0, - "index": 26184 - }, - "end": { - "line": 1079, - "column": 3, - "index": 28932 - } - }, - "context": { - "loc": { - "start": { - "line": 1080, - "column": 0, - "index": 28933 - }, - "end": { - "line": 1084, - "column": 2, - "index": 29075 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "strengthFill", - "lineNumber": 27, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a number (0-255) for the strength of erasing under a shape's interior.\nDefaults to 255, which is full strength." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "strengthStroke", - "lineNumber": 29, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a number (0-255) for the strength of erasing under a shape's edge.\nDefaults to 255, which is full strength." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "erase", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "erase", - "kind": "function" - } - ], - "namespace": "erase" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Ends erasing that was started with " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "erase()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThe " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "fill()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "stroke()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "blendMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " settings will return to what they\nwere prior to calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "erase()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "noErase" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 1086, - "column": 0, - "index": 29077 - }, - "end": { - "line": 1108, - "column": 3, - "index": 29782 - } - }, - "context": { - "loc": { - "start": { - "line": 1109, - "column": 0, - "index": 29783 - }, - "end": { - "line": 1112, - "column": 2, - "index": 29864 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/color/setting.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "noErase", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "noErase", - "kind": "function" - } - ], - "namespace": "noErase" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Constants" - }, - { - "title": "submodule", - "description": "Constants", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 5, - "column": 3, - "index": 63 - } - }, - "context": { - "loc": { - "start": { - "line": 7, - "column": 0, - "index": 65 - }, - "end": { - "line": 7, - "column": 20, - "index": 85 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Constants", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Constants", - "kind": "module" - } - ], - "namespace": "Constants" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Version of this p5.js." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "VERSION" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 87 - }, - "end": { - "line": 13, - "column": 3, - "index": 160 - } - }, - "context": { - "loc": { - "start": { - "line": 14, - "column": 0, - "index": 161 - }, - "end": { - "line": 15, - "column": 63, - "index": 247 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "VERSION", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "VERSION", - "kind": "constant", - "type": { - "type": "NameExpression", - "name": "string" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "VERSION", - "kind": "constant" - } - ], - "namespace": "VERSION" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The default, two-dimensional renderer." - } - ] - } - ] - }, - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 2, - "type": null, - "errors": [ - "not reach to EOF" - ], - "name": "P2D" - }, - { - "title": "property", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "P2D" - }, - "name": "P2D" - }, - { - "title": "final", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 18, - "column": 0, - "index": 270 - }, - "end": { - "line": 23, - "column": 3, - "index": 384 - } - }, - "context": { - "loc": { - "start": { - "line": 24, - "column": 0, - "index": 385 - }, - "end": { - "line": 24, - "column": 33, - "index": 418 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "P2D", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "P2D" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "P2D", - "kind": "constant", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "P2D", - "kind": "constant" - } - ], - "namespace": "P2D" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "One of the two render modes in p5.js, used for computationally intensive tasks like 3D rendering and shaders." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " differs from the default " - }, - { - "type": "html", - "value": "" - }, - { - "type": "inlineCode", - "value": "P2D" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " renderer in the following ways:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Coordinate System" - } - ] - }, - { - "type": "text", - "value": " - When drawing in " - }, - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " mode, the origin point (0,0,0) is located at the center of the screen, not the top-left corner. See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "the learn page about coordinates and transformations" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "3D Shapes" - } - ] - }, - { - "type": "text", - "value": " - " - }, - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " mode can be used to draw 3-dimensional shapes like " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "box()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "sphere()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "cone()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "more" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "the learn page about custom geometry" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to make more complex objects." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Shape Detail" - } - ] - }, - { - "type": "text", - "value": " - When drawing in " - }, - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " mode, you can specify how smooth curves should be drawn by using a " - }, - { - "type": "inlineCode", - "value": "detail" - }, - { - "type": "text", - "value": " parameter. See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "the wiki section about shapes" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for a more information and an example." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Textures" - } - ] - }, - { - "type": "text", - "value": " - A texture is like a skin that wraps onto a shape. See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "the wiki section about textures" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for examples of mapping images onto surfaces with textures." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Materials and Lighting" - } - ] - }, - { - "type": "text", - "value": " - " - }, - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " offers different types of lights like " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "ambientLight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to place around a scene. Materials like " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "specularMaterial()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " reflect the lighting to convey shape and depth. See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "the learn page for styling and appearance" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to experiment with different combinations." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Camera" - } - ] - }, - { - "type": "text", - "value": " - The viewport of a " - }, - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " sketch can be adjusted by changing camera attributes. See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "the learn page section about cameras" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for an explanation of camera controls." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Text" - } - ] - }, - { - "type": "text", - "value": " - " - }, - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " requires opentype/truetype font files to be preloaded using " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadFont()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "the wiki section about text" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for details, along with a workaround." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Shaders" - } - ] - }, - { - "type": "text", - "value": " - Shaders are hardware accelerated programs that can be used for a variety of effects and graphics. See the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "introduction to shaders" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to get started with shaders in p5.js." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Graphics Acceleration" - } - ] - }, - { - "type": "text", - "value": " - " - }, - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " mode uses the graphics card instead of the CPU, so it may help boost the performance of your sketch (example: drawing more shapes on the screen at once)." - } - ] - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "To learn more about WEBGL mode, check out " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "all the interactive WEBGL tutorials" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " in the \"Learn\" section of this website, or read the wiki article " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\"Getting started with WebGL in p5\"" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 17, - "type": null, - "errors": [ - "not reach to EOF" - ], - "name": "WEBGL" - }, - { - "title": "property", - "description": null, - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "WEBGL" - }, - "name": "WEBGL" - }, - { - "title": "final", - "description": null, - "lineNumber": 19 - } - ], - "loc": { - "start": { - "line": 25, - "column": 0, - "index": 419 - }, - "end": { - "line": 45, - "column": 3, - "index": 3841 - } - }, - "context": { - "loc": { - "start": { - "line": 46, - "column": 0, - "index": 3842 - }, - "end": { - "line": 46, - "column": 37, - "index": 3879 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "WEBGL", - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "WEBGL" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "WEBGL", - "kind": "constant", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "WEBGL", - "kind": "constant" - } - ], - "namespace": "WEBGL" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 4, - "type": null, - "errors": [ - "not reach to EOF" - ], - "name": "WEBGL2" - }, - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "WEBGL2" - }, - "name": "WEBGL2" - }, - { - "title": "final", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 47, - "column": 0, - "index": 3880 - }, - "end": { - "line": 54, - "column": 3, - "index": 4125 - } - }, - "context": { - "loc": { - "start": { - "line": 55, - "column": 0, - "index": 4126 - }, - "end": { - "line": 55, - "column": 39, - "index": 4165 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "WEBGL2", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "WEBGL2" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "WEBGL2", - "kind": "constant", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "WEBGL2", - "kind": "constant" - } - ], - "namespace": "WEBGL2" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "default" - }, - "name": "ARROW" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "ARROW" - }, - "name": "ARROW" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 58, - "column": 0, - "index": 4182 - }, - "end": { - "line": 62, - "column": 3, - "index": 4256 - } - }, - "context": { - "loc": { - "start": { - "line": 63, - "column": 0, - "index": 4257 - }, - "end": { - "line": 63, - "column": 31, - "index": 4288 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "ARROW", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "ARROW" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "ARROW", - "type": { - "type": "StringLiteralType", - "value": "default" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ARROW", - "kind": "typedef" - } - ], - "namespace": "ARROW" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "crosshair" - }, - "name": "CROSS" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CROSS" - }, - "name": "CROSS" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 64, - "column": 0, - "index": 4289 - }, - "end": { - "line": 68, - "column": 3, - "index": 4365 - } - }, - "context": { - "loc": { - "start": { - "line": 69, - "column": 0, - "index": 4366 - }, - "end": { - "line": 69, - "column": 33, - "index": 4399 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "CROSS", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CROSS" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "CROSS", - "type": { - "type": "StringLiteralType", - "value": "crosshair" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "CROSS", - "kind": "typedef" - } - ], - "namespace": "CROSS" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "pointer" - }, - "name": "HAND" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "HAND" - }, - "name": "HAND" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 70, - "column": 0, - "index": 4400 - }, - "end": { - "line": 74, - "column": 3, - "index": 4471 - } - }, - "context": { - "loc": { - "start": { - "line": 75, - "column": 0, - "index": 4472 - }, - "end": { - "line": 75, - "column": 30, - "index": 4502 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "HAND", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "HAND" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "HAND", - "type": { - "type": "StringLiteralType", - "value": "pointer" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "HAND", - "kind": "typedef" - } - ], - "namespace": "HAND" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "move" - }, - "name": "MOVE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "MOVE" - }, - "name": "MOVE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 76, - "column": 0, - "index": 4503 - }, - "end": { - "line": 80, - "column": 3, - "index": 4571 - } - }, - "context": { - "loc": { - "start": { - "line": 81, - "column": 0, - "index": 4572 - }, - "end": { - "line": 81, - "column": 27, - "index": 4599 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "MOVE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "MOVE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "MOVE", - "type": { - "type": "StringLiteralType", - "value": "move" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "MOVE", - "kind": "typedef" - } - ], - "namespace": "MOVE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "text" - }, - "name": "TEXT" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "TEXT" - }, - "name": "TEXT" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 82, - "column": 0, - "index": 4600 - }, - "end": { - "line": 86, - "column": 3, - "index": 4668 - } - }, - "context": { - "loc": { - "start": { - "line": 87, - "column": 0, - "index": 4669 - }, - "end": { - "line": 87, - "column": 27, - "index": 4696 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "TEXT", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "TEXT" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "TEXT", - "type": { - "type": "StringLiteralType", - "value": "text" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "TEXT", - "kind": "typedef" - } - ], - "namespace": "TEXT" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "wait" - }, - "name": "WAIT" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "WAIT" - }, - "name": "WAIT" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 88, - "column": 0, - "index": 4697 - }, - "end": { - "line": 92, - "column": 3, - "index": 4765 - } - }, - "context": { - "loc": { - "start": { - "line": 93, - "column": 0, - "index": 4766 - }, - "end": { - "line": 93, - "column": 27, - "index": 4793 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "WAIT", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "WAIT" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "WAIT", - "type": { - "type": "StringLiteralType", - "value": "wait" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "WAIT", - "kind": "typedef" - } - ], - "namespace": "WAIT" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "sin()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "cos()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "HALF_PI" - }, - { - "title": "final", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\narc(50, 50, 80, 80, 0, HALF_PI);\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "80×80 white quarter-circle with curve toward bottom right of canvas.", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 97, - "column": 0, - "index": 4812 - }, - "end": { - "line": 113, - "column": 3, - "index": 5309 - } - }, - "context": { - "loc": { - "start": { - "line": 114, - "column": 0, - "index": 5310 - }, - "end": { - "line": 114, - "column": 31, - "index": 5341 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [ - { - "description": "
\narc(50, 50, 80, 80, 0, HALF_PI);\n
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "HALF_PI", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "HALF_PI", - "kind": "constant", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "HALF_PI", - "kind": "constant" - } - ], - "namespace": "HALF_PI" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "sin()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "cos()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "PI" - }, - { - "title": "final", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\narc(50, 50, 80, 80, 0, PI);\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "white half-circle with curve toward bottom of canvas.", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 115, - "column": 0, - "index": 5342 - }, - "end": { - "line": 131, - "column": 3, - "index": 5804 - } - }, - "context": { - "loc": { - "start": { - "line": 132, - "column": 0, - "index": 5805 - }, - "end": { - "line": 132, - "column": 22, - "index": 5827 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [ - { - "description": "
\narc(50, 50, 80, 80, 0, PI);\n
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "PI", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "PI", - "kind": "constant", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "PI", - "kind": "constant" - } - ], - "namespace": "PI" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "sin()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "cos()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "QUARTER_PI" - }, - { - "title": "final", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\narc(50, 50, 80, 80, 0, QUARTER_PI);\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "white eighth-circle rotated about 40 degrees with curve bottom right canvas.", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 133, - "column": 0, - "index": 5828 - }, - "end": { - "line": 149, - "column": 3, - "index": 6336 - } - }, - "context": { - "loc": { - "start": { - "line": 150, - "column": 0, - "index": 6337 - }, - "end": { - "line": 150, - "column": 34, - "index": 6371 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [ - { - "description": "
\narc(50, 50, 80, 80, 0, QUARTER_PI);\n
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "QUARTER_PI", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "QUARTER_PI", - "kind": "constant", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "QUARTER_PI", - "kind": "constant" - } - ], - "namespace": "QUARTER_PI" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "sin()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "cos()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "TAU" - }, - { - "title": "final", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\narc(50, 50, 80, 80, 0, TAU);\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "80×80 white ellipse shape in center of canvas.", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 151, - "column": 0, - "index": 6372 - }, - "end": { - "line": 167, - "column": 3, - "index": 6857 - } - }, - "context": { - "loc": { - "start": { - "line": 168, - "column": 0, - "index": 6858 - }, - "end": { - "line": 168, - "column": 27, - "index": 6885 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [ - { - "description": "
\narc(50, 50, 80, 80, 0, TAU);\n
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "TAU", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "TAU", - "kind": "constant", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "TAU", - "kind": "constant" - } - ], - "namespace": "TAU" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "sin()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "cos()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "TWO_PI" - }, - { - "title": "final", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\narc(50, 50, 80, 80, 0, TWO_PI);\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "80×80 white ellipse shape in center of canvas.", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 169, - "column": 0, - "index": 6886 - }, - "end": { - "line": 185, - "column": 3, - "index": 7359 - } - }, - "context": { - "loc": { - "start": { - "line": 186, - "column": 0, - "index": 7360 - }, - "end": { - "line": 186, - "column": 30, - "index": 7390 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [ - { - "description": "
\narc(50, 50, 80, 80, 0, TWO_PI);\n
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "TWO_PI", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "TWO_PI", - "kind": "constant", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "TWO_PI", - "kind": "constant" - } - ], - "namespace": "TWO_PI" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Constant to be used with the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function, to set the mode in\nwhich p5.js interprets and calculates angles (either DEGREES or RADIANS)." - } - ] - } - ] - }, - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 3, - "type": null, - "errors": [ - "not reach to EOF" - ], - "name": "DEGREES" - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "DEGREES" - }, - "name": "DEGREES" - }, - { - "title": "final", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\nfunction setup() {\n angleMode(DEGREES);\n}\n
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 187, - "column": 0, - "index": 7391 - }, - "end": { - "line": 200, - "column": 3, - "index": 7770 - } - }, - "context": { - "loc": { - "start": { - "line": 201, - "column": 0, - "index": 7771 - }, - "end": { - "line": 201, - "column": 41, - "index": 7812 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nfunction setup() {\n angleMode(DEGREES);\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "DEGREES", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "DEGREES" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "DEGREES", - "kind": "constant", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "DEGREES", - "kind": "constant" - } - ], - "namespace": "DEGREES" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Constant to be used with the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function, to set the mode\nin which p5.js interprets and calculates angles (either RADIANS or DEGREES)." - } - ] - } - ] - }, - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 3, - "type": null, - "errors": [ - "not reach to EOF" - ], - "name": "RADIANS" - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "RADIANS" - }, - "name": "RADIANS" - }, - { - "title": "final", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\nfunction setup() {\n angleMode(RADIANS);\n}\n
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 202, - "column": 0, - "index": 7813 - }, - "end": { - "line": 215, - "column": 3, - "index": 8192 - } - }, - "context": { - "loc": { - "start": { - "line": 216, - "column": 0, - "index": 8193 - }, - "end": { - "line": 216, - "column": 41, - "index": 8234 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nfunction setup() {\n angleMode(RADIANS);\n}\n
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "RADIANS", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "RADIANS" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "RADIANS", - "kind": "constant", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "RADIANS", - "kind": "constant" - } - ], - "namespace": "RADIANS" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "corner" - }, - "name": "CORNER" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CORNER" - }, - "name": "CORNER" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 221, - "column": 0, - "index": 8323 - }, - "end": { - "line": 225, - "column": 3, - "index": 8399 - } - }, - "context": { - "loc": { - "start": { - "line": 226, - "column": 0, - "index": 8400 - }, - "end": { - "line": 226, - "column": 31, - "index": 8431 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "CORNER", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CORNER" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "CORNER", - "type": { - "type": "StringLiteralType", - "value": "corner" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "CORNER", - "kind": "typedef" - } - ], - "namespace": "CORNER" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "corners" - }, - "name": "CORNERS" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CORNERS" - }, - "name": "CORNERS" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 227, - "column": 0, - "index": 8432 - }, - "end": { - "line": 231, - "column": 3, - "index": 8512 - } - }, - "context": { - "loc": { - "start": { - "line": 232, - "column": 0, - "index": 8513 - }, - "end": { - "line": 232, - "column": 33, - "index": 8546 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "CORNERS", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CORNERS" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "CORNERS", - "type": { - "type": "StringLiteralType", - "value": "corners" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "CORNERS", - "kind": "typedef" - } - ], - "namespace": "CORNERS" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "radius" - }, - "name": "RADIUS" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "RADIUS" - }, - "name": "RADIUS" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 233, - "column": 0, - "index": 8547 - }, - "end": { - "line": 237, - "column": 3, - "index": 8623 - } - }, - "context": { - "loc": { - "start": { - "line": 238, - "column": 0, - "index": 8624 - }, - "end": { - "line": 238, - "column": 31, - "index": 8655 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "RADIUS", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "RADIUS" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "RADIUS", - "type": { - "type": "StringLiteralType", - "value": "radius" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "RADIUS", - "kind": "typedef" - } - ], - "namespace": "RADIUS" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "right" - }, - "name": "RIGHT" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "RIGHT" - }, - "name": "RIGHT" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 239, - "column": 0, - "index": 8656 - }, - "end": { - "line": 243, - "column": 3, - "index": 8728 - } - }, - "context": { - "loc": { - "start": { - "line": 244, - "column": 0, - "index": 8729 - }, - "end": { - "line": 244, - "column": 29, - "index": 8758 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "RIGHT", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "RIGHT" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "RIGHT", - "type": { - "type": "StringLiteralType", - "value": "right" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "RIGHT", - "kind": "typedef" - } - ], - "namespace": "RIGHT" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "left" - }, - "name": "LEFT" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "LEFT" - }, - "name": "LEFT" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 245, - "column": 0, - "index": 8759 - }, - "end": { - "line": 249, - "column": 3, - "index": 8827 - } - }, - "context": { - "loc": { - "start": { - "line": 250, - "column": 0, - "index": 8828 - }, - "end": { - "line": 250, - "column": 27, - "index": 8855 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "LEFT", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "LEFT" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "LEFT", - "type": { - "type": "StringLiteralType", - "value": "left" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "LEFT", - "kind": "typedef" - } - ], - "namespace": "LEFT" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "center" - }, - "name": "CENTER" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CENTER" - }, - "name": "CENTER" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 251, - "column": 0, - "index": 8856 - }, - "end": { - "line": 255, - "column": 3, - "index": 8932 - } - }, - "context": { - "loc": { - "start": { - "line": 256, - "column": 0, - "index": 8933 - }, - "end": { - "line": 256, - "column": 31, - "index": 8964 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "CENTER", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CENTER" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "CENTER", - "type": { - "type": "StringLiteralType", - "value": "center" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "CENTER", - "kind": "typedef" - } - ], - "namespace": "CENTER" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "top" - }, - "name": "TOP" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "TOP" - }, - "name": "TOP" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 257, - "column": 0, - "index": 8965 - }, - "end": { - "line": 261, - "column": 3, - "index": 9029 - } - }, - "context": { - "loc": { - "start": { - "line": 262, - "column": 0, - "index": 9030 - }, - "end": { - "line": 262, - "column": 25, - "index": 9055 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "TOP", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "TOP" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "TOP", - "type": { - "type": "StringLiteralType", - "value": "top" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "TOP", - "kind": "typedef" - } - ], - "namespace": "TOP" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "bottom" - }, - "name": "BOTTOM" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "BOTTOM" - }, - "name": "BOTTOM" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 263, - "column": 0, - "index": 9056 - }, - "end": { - "line": 267, - "column": 3, - "index": 9132 - } - }, - "context": { - "loc": { - "start": { - "line": 268, - "column": 0, - "index": 9133 - }, - "end": { - "line": 268, - "column": 31, - "index": 9164 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "BOTTOM", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "BOTTOM" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "BOTTOM", - "type": { - "type": "StringLiteralType", - "value": "bottom" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "BOTTOM", - "kind": "typedef" - } - ], - "namespace": "BOTTOM" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "alphabetic" - }, - "name": "BASELINE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "BASELINE" - }, - "name": "BASELINE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 269, - "column": 0, - "index": 9165 - }, - "end": { - "line": 273, - "column": 3, - "index": 9251 - } - }, - "context": { - "loc": { - "start": { - "line": 274, - "column": 0, - "index": 9252 - }, - "end": { - "line": 274, - "column": 37, - "index": 9289 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "BASELINE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "BASELINE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "BASELINE", - "type": { - "type": "StringLiteralType", - "value": "alphabetic" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "BASELINE", - "kind": "typedef" - } - ], - "namespace": "BASELINE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 0 - }, - "name": "POINTS" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "POINTS" - }, - "name": "POINTS" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 275, - "column": 0, - "index": 9290 - }, - "end": { - "line": 279, - "column": 3, - "index": 9364 - } - }, - "context": { - "loc": { - "start": { - "line": 280, - "column": 0, - "index": 9365 - }, - "end": { - "line": 280, - "column": 29, - "index": 9394 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "POINTS", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "POINTS" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "POINTS", - "type": { - "type": "NumericLiteralType", - "value": 0 - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "POINTS", - "kind": "typedef" - } - ], - "namespace": "POINTS" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 1 - }, - "name": "LINES" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "LINES" - }, - "name": "LINES" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 281, - "column": 0, - "index": 9395 - }, - "end": { - "line": 285, - "column": 3, - "index": 9466 - } - }, - "context": { - "loc": { - "start": { - "line": 286, - "column": 0, - "index": 9467 - }, - "end": { - "line": 286, - "column": 28, - "index": 9495 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "LINES", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "LINES" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "LINES", - "type": { - "type": "NumericLiteralType", - "value": 1 - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "LINES", - "kind": "typedef" - } - ], - "namespace": "LINES" - }, - { - "description": "", - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 3 - }, - "name": "LINE_STRIP" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "LINE_STRIP" - }, - "name": "LINE_STRIP" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 287, - "column": 0, - "index": 9496 - }, - "end": { - "line": 291, - "column": 3, - "index": 9583 - } - }, - "context": { - "loc": { - "start": { - "line": 292, - "column": 0, - "index": 9584 - }, - "end": { - "line": 292, - "column": 33, - "index": 9617 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "LINE_STRIP", - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 3 - } - }, - { - "title": "property", - "name": "LINE_STRIP", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "LINE_STRIP" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "LINE_STRIP", - "kind": "constant", - "type": { - "type": "NameExpression", - "name": "number" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "LINE_STRIP", - "kind": "constant" - } - ], - "namespace": "LINE_STRIP" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 2 - }, - "name": "LINE_LOOP" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "LINE_LOOP" - }, - "name": "LINE_LOOP" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 293, - "column": 0, - "index": 9618 - }, - "end": { - "line": 297, - "column": 3, - "index": 9701 - } - }, - "context": { - "loc": { - "start": { - "line": 298, - "column": 0, - "index": 9702 - }, - "end": { - "line": 298, - "column": 32, - "index": 9734 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "LINE_LOOP", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "LINE_LOOP" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "LINE_LOOP", - "type": { - "type": "NumericLiteralType", - "value": 2 - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "LINE_LOOP", - "kind": "typedef" - } - ], - "namespace": "LINE_LOOP" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 4 - }, - "name": "TRIANGLES" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "TRIANGLES" - }, - "name": "TRIANGLES" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 299, - "column": 0, - "index": 9735 - }, - "end": { - "line": 303, - "column": 3, - "index": 9818 - } - }, - "context": { - "loc": { - "start": { - "line": 304, - "column": 0, - "index": 9819 - }, - "end": { - "line": 304, - "column": 32, - "index": 9851 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "TRIANGLES", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "TRIANGLES" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "TRIANGLES", - "type": { - "type": "NumericLiteralType", - "value": 4 - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "TRIANGLES", - "kind": "typedef" - } - ], - "namespace": "TRIANGLES" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 6 - }, - "name": "TRIANGLE_FAN" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "TRIANGLE_FAN" - }, - "name": "TRIANGLE_FAN" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 305, - "column": 0, - "index": 9852 - }, - "end": { - "line": 309, - "column": 3, - "index": 9944 - } - }, - "context": { - "loc": { - "start": { - "line": 310, - "column": 0, - "index": 9945 - }, - "end": { - "line": 310, - "column": 35, - "index": 9980 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "TRIANGLE_FAN", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "TRIANGLE_FAN" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "TRIANGLE_FAN", - "type": { - "type": "NumericLiteralType", - "value": 6 - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "TRIANGLE_FAN", - "kind": "typedef" - } - ], - "namespace": "TRIANGLE_FAN" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 5 - }, - "name": "TRIANGLE_STRIP" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "TRIANGLE_STRIP" - }, - "name": "TRIANGLE_STRIP" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 311, - "column": 0, - "index": 9981 - }, - "end": { - "line": 315, - "column": 3, - "index": 10079 - } - }, - "context": { - "loc": { - "start": { - "line": 316, - "column": 0, - "index": 10080 - }, - "end": { - "line": 316, - "column": 37, - "index": 10117 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "TRIANGLE_STRIP", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "TRIANGLE_STRIP" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "TRIANGLE_STRIP", - "type": { - "type": "NumericLiteralType", - "value": 5 - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "TRIANGLE_STRIP", - "kind": "typedef" - } - ], - "namespace": "TRIANGLE_STRIP" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "quads" - }, - "name": "QUADS" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "QUADS" - }, - "name": "QUADS" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 317, - "column": 0, - "index": 10118 - }, - "end": { - "line": 321, - "column": 3, - "index": 10190 - } - }, - "context": { - "loc": { - "start": { - "line": 322, - "column": 0, - "index": 10191 - }, - "end": { - "line": 322, - "column": 29, - "index": 10220 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "QUADS", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "QUADS" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "QUADS", - "type": { - "type": "StringLiteralType", - "value": "quads" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "QUADS", - "kind": "typedef" - } - ], - "namespace": "QUADS" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "quad_strip" - }, - "name": "QUAD_STRIP" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "QUAD_STRIP" - }, - "name": "QUAD_STRIP" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 323, - "column": 0, - "index": 10221 - }, - "end": { - "line": 327, - "column": 3, - "index": 10313 - } - }, - "context": { - "loc": { - "start": { - "line": 328, - "column": 0, - "index": 10314 - }, - "end": { - "line": 328, - "column": 39, - "index": 10353 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "QUAD_STRIP", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "QUAD_STRIP" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "QUAD_STRIP", - "type": { - "type": "StringLiteralType", - "value": "quad_strip" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "QUAD_STRIP", - "kind": "typedef" - } - ], - "namespace": "QUAD_STRIP" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "tess" - }, - "name": "TESS" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "TESS" - }, - "name": "TESS" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 329, - "column": 0, - "index": 10354 - }, - "end": { - "line": 333, - "column": 3, - "index": 10422 - } - }, - "context": { - "loc": { - "start": { - "line": 334, - "column": 0, - "index": 10423 - }, - "end": { - "line": 334, - "column": 27, - "index": 10450 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "TESS", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "TESS" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "TESS", - "type": { - "type": "StringLiteralType", - "value": "tess" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "TESS", - "kind": "typedef" - } - ], - "namespace": "TESS" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "close" - }, - "name": "CLOSE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CLOSE" - }, - "name": "CLOSE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 335, - "column": 0, - "index": 10451 - }, - "end": { - "line": 339, - "column": 3, - "index": 10523 - } - }, - "context": { - "loc": { - "start": { - "line": 340, - "column": 0, - "index": 10524 - }, - "end": { - "line": 340, - "column": 29, - "index": 10553 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "CLOSE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CLOSE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "CLOSE", - "type": { - "type": "StringLiteralType", - "value": "close" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "CLOSE", - "kind": "typedef" - } - ], - "namespace": "CLOSE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "open" - }, - "name": "OPEN" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "OPEN" - }, - "name": "OPEN" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 341, - "column": 0, - "index": 10554 - }, - "end": { - "line": 345, - "column": 3, - "index": 10622 - } - }, - "context": { - "loc": { - "start": { - "line": 346, - "column": 0, - "index": 10623 - }, - "end": { - "line": 346, - "column": 27, - "index": 10650 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "OPEN", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "OPEN" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "OPEN", - "type": { - "type": "StringLiteralType", - "value": "open" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "OPEN", - "kind": "typedef" - } - ], - "namespace": "OPEN" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "chord" - }, - "name": "CHORD" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CHORD" - }, - "name": "CHORD" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 347, - "column": 0, - "index": 10651 - }, - "end": { - "line": 351, - "column": 3, - "index": 10723 - } - }, - "context": { - "loc": { - "start": { - "line": 352, - "column": 0, - "index": 10724 - }, - "end": { - "line": 352, - "column": 29, - "index": 10753 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "CHORD", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CHORD" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "CHORD", - "type": { - "type": "StringLiteralType", - "value": "chord" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "CHORD", - "kind": "typedef" - } - ], - "namespace": "CHORD" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "pie" - }, - "name": "PIE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "PIE" - }, - "name": "PIE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 353, - "column": 0, - "index": 10754 - }, - "end": { - "line": 357, - "column": 3, - "index": 10818 - } - }, - "context": { - "loc": { - "start": { - "line": 358, - "column": 0, - "index": 10819 - }, - "end": { - "line": 358, - "column": 25, - "index": 10844 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "PIE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "PIE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "PIE", - "type": { - "type": "StringLiteralType", - "value": "pie" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "PIE", - "kind": "typedef" - } - ], - "namespace": "PIE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "square" - }, - "name": "PROJECT" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "PROJECT" - }, - "name": "PROJECT" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 359, - "column": 0, - "index": 10845 - }, - "end": { - "line": 363, - "column": 3, - "index": 10924 - } - }, - "context": { - "loc": { - "start": { - "line": 364, - "column": 0, - "index": 10925 - }, - "end": { - "line": 364, - "column": 32, - "index": 10957 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "PROJECT", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "PROJECT" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "PROJECT", - "type": { - "type": "StringLiteralType", - "value": "square" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "PROJECT", - "kind": "typedef" - } - ], - "namespace": "PROJECT" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "butt" - }, - "name": "SQUARE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "SQUERE" - }, - "name": "SQUARE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 365, - "column": 0, - "index": 11000 - }, - "end": { - "line": 369, - "column": 3, - "index": 11074 - } - }, - "context": { - "loc": { - "start": { - "line": 370, - "column": 0, - "index": 11075 - }, - "end": { - "line": 370, - "column": 29, - "index": 11104 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "SQUARE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "SQUERE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "SQUARE", - "type": { - "type": "StringLiteralType", - "value": "butt" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "SQUARE", - "kind": "typedef" - } - ], - "namespace": "SQUARE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "round" - }, - "name": "ROUND" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "ROUND" - }, - "name": "ROUND" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 371, - "column": 0, - "index": 11105 - }, - "end": { - "line": 375, - "column": 3, - "index": 11177 - } - }, - "context": { - "loc": { - "start": { - "line": 376, - "column": 0, - "index": 11178 - }, - "end": { - "line": 376, - "column": 29, - "index": 11207 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "ROUND", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "ROUND" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "ROUND", - "type": { - "type": "StringLiteralType", - "value": "round" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ROUND", - "kind": "typedef" - } - ], - "namespace": "ROUND" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "bevel" - }, - "name": "BEVEL" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "BEVEL" - }, - "name": "BEVEL" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 377, - "column": 0, - "index": 11208 - }, - "end": { - "line": 381, - "column": 3, - "index": 11280 - } - }, - "context": { - "loc": { - "start": { - "line": 382, - "column": 0, - "index": 11281 - }, - "end": { - "line": 382, - "column": 29, - "index": 11310 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "BEVEL", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "BEVEL" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "BEVEL", - "type": { - "type": "StringLiteralType", - "value": "bevel" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "BEVEL", - "kind": "typedef" - } - ], - "namespace": "BEVEL" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "miter" - }, - "name": "MITER" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "MITER" - }, - "name": "MITER" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 383, - "column": 0, - "index": 11311 - }, - "end": { - "line": 387, - "column": 3, - "index": 11383 - } - }, - "context": { - "loc": { - "start": { - "line": 388, - "column": 0, - "index": 11384 - }, - "end": { - "line": 388, - "column": 29, - "index": 11413 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "MITER", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "MITER" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "MITER", - "type": { - "type": "StringLiteralType", - "value": "miter" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "MITER", - "kind": "typedef" - } - ], - "namespace": "MITER" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "rgb" - }, - "name": "RGB" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "RGB" - }, - "name": "RGB" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 391, - "column": 0, - "index": 11424 - }, - "end": { - "line": 395, - "column": 3, - "index": 11488 - } - }, - "context": { - "loc": { - "start": { - "line": 396, - "column": 0, - "index": 11489 - }, - "end": { - "line": 396, - "column": 25, - "index": 11514 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "RGB", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "RGB" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "RGB", - "type": { - "type": "StringLiteralType", - "value": "rgb" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "RGB", - "kind": "typedef" - } - ], - "namespace": "RGB" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "HSB (hue, saturation, brightness) is a type of color model.\nYou can learn more about it at\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "HSB" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 5, - "type": { - "type": "StringLiteralType", - "value": "hsb" - }, - "name": "HSB" - }, - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "HSB" - }, - "name": "HSB" - }, - { - "title": "final", - "description": null, - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 397, - "column": 0, - "index": 11515 - }, - "end": { - "line": 405, - "column": 3, - "index": 11776 - } - }, - "context": { - "loc": { - "start": { - "line": 406, - "column": 0, - "index": 11777 - }, - "end": { - "line": 406, - "column": 25, - "index": 11802 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "HSB", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "HSB" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "HSB", - "type": { - "type": "StringLiteralType", - "value": "hsb" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "HSB", - "kind": "typedef" - } - ], - "namespace": "HSB" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "hsl" - }, - "name": "HSL" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "HSL" - }, - "name": "HSL" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 407, - "column": 0, - "index": 11803 - }, - "end": { - "line": 411, - "column": 3, - "index": 11867 - } - }, - "context": { - "loc": { - "start": { - "line": 412, - "column": 0, - "index": 11868 - }, - "end": { - "line": 412, - "column": 25, - "index": 11893 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "HSL", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "HSL" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "HSL", - "type": { - "type": "StringLiteralType", - "value": "hsl" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "HSL", - "kind": "typedef" - } - ], - "namespace": "HSL" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "size" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function as AUTO, at a time." - } - ] - } - ] - }, - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 5, - "type": { - "type": "StringLiteralType", - "value": "auto" - }, - "name": "AUTO" - }, - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "AUTO" - }, - "name": "AUTO" - }, - { - "title": "final", - "description": null, - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 415, - "column": 0, - "index": 11912 - }, - "end": { - "line": 423, - "column": 3, - "index": 12249 - } - }, - "context": { - "loc": { - "start": { - "line": 424, - "column": 0, - "index": 12250 - }, - "end": { - "line": 424, - "column": 27, - "index": 12277 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "AUTO", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "AUTO" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "AUTO", - "type": { - "type": "StringLiteralType", - "value": "auto" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "AUTO", - "kind": "typedef" - } - ], - "namespace": "AUTO" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 18 - }, - "name": "ALT" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "ALT" - }, - "name": "ALT" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 426, - "column": 0, - "index": 12279 - }, - "end": { - "line": 430, - "column": 3, - "index": 12340 - } - }, - "context": { - "loc": { - "start": { - "line": 432, - "column": 0, - "index": 12350 - }, - "end": { - "line": 432, - "column": 22, - "index": 12372 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "ALT", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "ALT" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "ALT", - "type": { - "type": "NumericLiteralType", - "value": 18 - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ALT", - "kind": "typedef" - } - ], - "namespace": "ALT" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 8 - }, - "name": "BACKSPACE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "BACKSPACE" - }, - "name": "BACKSPACE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 433, - "column": 0, - "index": 12373 - }, - "end": { - "line": 437, - "column": 3, - "index": 12451 - } - }, - "context": { - "loc": { - "start": { - "line": 438, - "column": 0, - "index": 12452 - }, - "end": { - "line": 438, - "column": 27, - "index": 12479 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "BACKSPACE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "BACKSPACE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "BACKSPACE", - "type": { - "type": "NumericLiteralType", - "value": 8 - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "BACKSPACE", - "kind": "typedef" - } - ], - "namespace": "BACKSPACE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 17 - }, - "name": "CONTROL" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CONTROL" - }, - "name": "CONTROL" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 439, - "column": 0, - "index": 12480 - }, - "end": { - "line": 443, - "column": 3, - "index": 12553 - } - }, - "context": { - "loc": { - "start": { - "line": 444, - "column": 0, - "index": 12554 - }, - "end": { - "line": 444, - "column": 26, - "index": 12580 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "CONTROL", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CONTROL" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "CONTROL", - "type": { - "type": "NumericLiteralType", - "value": 17 - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "CONTROL", - "kind": "typedef" - } - ], - "namespace": "CONTROL" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 46 - }, - "name": "DELETE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "DELETE" - }, - "name": "DELETE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 445, - "column": 0, - "index": 12581 - }, - "end": { - "line": 449, - "column": 3, - "index": 12651 - } - }, - "context": { - "loc": { - "start": { - "line": 450, - "column": 0, - "index": 12652 - }, - "end": { - "line": 450, - "column": 25, - "index": 12677 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "DELETE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "DELETE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "DELETE", - "type": { - "type": "NumericLiteralType", - "value": 46 - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "DELETE", - "kind": "typedef" - } - ], - "namespace": "DELETE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 40 - }, - "name": "DOWN_ARROW" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "DOWN_ARROW" - }, - "name": "DOWN_ARROW" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 451, - "column": 0, - "index": 12678 - }, - "end": { - "line": 455, - "column": 3, - "index": 12760 - } - }, - "context": { - "loc": { - "start": { - "line": 456, - "column": 0, - "index": 12761 - }, - "end": { - "line": 456, - "column": 29, - "index": 12790 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "DOWN_ARROW", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "DOWN_ARROW" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "DOWN_ARROW", - "type": { - "type": "NumericLiteralType", - "value": 40 - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "DOWN_ARROW", - "kind": "typedef" - } - ], - "namespace": "DOWN_ARROW" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 13 - }, - "name": "ENTER" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "ENTER" - }, - "name": "ENTER" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 457, - "column": 0, - "index": 12791 - }, - "end": { - "line": 461, - "column": 3, - "index": 12858 - } - }, - "context": { - "loc": { - "start": { - "line": 462, - "column": 0, - "index": 12859 - }, - "end": { - "line": 462, - "column": 24, - "index": 12883 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "ENTER", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "ENTER" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "ENTER", - "type": { - "type": "NumericLiteralType", - "value": 13 - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ENTER", - "kind": "typedef" - } - ], - "namespace": "ENTER" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 27 - }, - "name": "ESCAPE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "ESCAPE" - }, - "name": "ESCAPE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 463, - "column": 0, - "index": 12884 - }, - "end": { - "line": 467, - "column": 3, - "index": 12954 - } - }, - "context": { - "loc": { - "start": { - "line": 468, - "column": 0, - "index": 12955 - }, - "end": { - "line": 468, - "column": 25, - "index": 12980 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "ESCAPE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "ESCAPE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "ESCAPE", - "type": { - "type": "NumericLiteralType", - "value": 27 - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ESCAPE", - "kind": "typedef" - } - ], - "namespace": "ESCAPE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 37 - }, - "name": "LEFT_ARROW" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "LEFT_ARROW" - }, - "name": "LEFT_ARROW" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 469, - "column": 0, - "index": 12981 - }, - "end": { - "line": 473, - "column": 3, - "index": 13063 - } - }, - "context": { - "loc": { - "start": { - "line": 474, - "column": 0, - "index": 13064 - }, - "end": { - "line": 474, - "column": 29, - "index": 13093 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "LEFT_ARROW", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "LEFT_ARROW" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "LEFT_ARROW", - "type": { - "type": "NumericLiteralType", - "value": 37 - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "LEFT_ARROW", - "kind": "typedef" - } - ], - "namespace": "LEFT_ARROW" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 18 - }, - "name": "OPTION" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "OPTION" - }, - "name": "OPTION" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 475, - "column": 0, - "index": 13094 - }, - "end": { - "line": 479, - "column": 3, - "index": 13164 - } - }, - "context": { - "loc": { - "start": { - "line": 480, - "column": 0, - "index": 13165 - }, - "end": { - "line": 480, - "column": 25, - "index": 13190 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "OPTION", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "OPTION" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "OPTION", - "type": { - "type": "NumericLiteralType", - "value": 18 - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "OPTION", - "kind": "typedef" - } - ], - "namespace": "OPTION" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 13 - }, - "name": "RETURN" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "RETURN" - }, - "name": "RETURN" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 481, - "column": 0, - "index": 13191 - }, - "end": { - "line": 485, - "column": 3, - "index": 13261 - } - }, - "context": { - "loc": { - "start": { - "line": 486, - "column": 0, - "index": 13262 - }, - "end": { - "line": 486, - "column": 25, - "index": 13287 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "RETURN", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "RETURN" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "RETURN", - "type": { - "type": "NumericLiteralType", - "value": 13 - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "RETURN", - "kind": "typedef" - } - ], - "namespace": "RETURN" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 39 - }, - "name": "RIGHT_ARROW" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "RIGHT_ARROW" - }, - "name": "RIGHT_ARROW" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 487, - "column": 0, - "index": 13288 - }, - "end": { - "line": 491, - "column": 3, - "index": 13373 - } - }, - "context": { - "loc": { - "start": { - "line": 492, - "column": 0, - "index": 13374 - }, - "end": { - "line": 492, - "column": 30, - "index": 13404 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "RIGHT_ARROW", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "RIGHT_ARROW" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "RIGHT_ARROW", - "type": { - "type": "NumericLiteralType", - "value": 39 - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "RIGHT_ARROW", - "kind": "typedef" - } - ], - "namespace": "RIGHT_ARROW" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 16 - }, - "name": "SHIFT" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "SHIFT" - }, - "name": "SHIFT" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 493, - "column": 0, - "index": 13405 - }, - "end": { - "line": 497, - "column": 3, - "index": 13472 - } - }, - "context": { - "loc": { - "start": { - "line": 498, - "column": 0, - "index": 13473 - }, - "end": { - "line": 498, - "column": 24, - "index": 13497 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "SHIFT", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "SHIFT" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "SHIFT", - "type": { - "type": "NumericLiteralType", - "value": 16 - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "SHIFT", - "kind": "typedef" - } - ], - "namespace": "SHIFT" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 9 - }, - "name": "TAB" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "TAB" - }, - "name": "TAB" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 499, - "column": 0, - "index": 13498 - }, - "end": { - "line": 503, - "column": 3, - "index": 13558 - } - }, - "context": { - "loc": { - "start": { - "line": 504, - "column": 0, - "index": 13559 - }, - "end": { - "line": 504, - "column": 21, - "index": 13580 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "TAB", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "TAB" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "TAB", - "type": { - "type": "NumericLiteralType", - "value": 9 - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "TAB", - "kind": "typedef" - } - ], - "namespace": "TAB" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "NumericLiteralType", - "value": 38 - }, - "name": "UP_ARROW" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "UP_ARROW" - }, - "name": "UP_ARROW" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 505, - "column": 0, - "index": 13581 - }, - "end": { - "line": 509, - "column": 3, - "index": 13657 - } - }, - "context": { - "loc": { - "start": { - "line": 510, - "column": 0, - "index": 13658 - }, - "end": { - "line": 510, - "column": 27, - "index": 13685 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "UP_ARROW", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "UP_ARROW" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "UP_ARROW", - "type": { - "type": "NumericLiteralType", - "value": 38 - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "UP_ARROW", - "kind": "typedef" - } - ], - "namespace": "UP_ARROW" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "source-over" - }, - "name": "BLEND" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "BLEND" - }, - "name": "BLEND" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 513, - "column": 0, - "index": 13700 - }, - "end": { - "line": 517, - "column": 3, - "index": 13778 - } - }, - "context": { - "loc": { - "start": { - "line": 518, - "column": 0, - "index": 13779 - }, - "end": { - "line": 518, - "column": 35, - "index": 13814 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "BLEND", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "BLEND" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "BLEND", - "type": { - "type": "StringLiteralType", - "value": "source-over" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "BLEND", - "kind": "typedef" - } - ], - "namespace": "BLEND" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "destination-out" - }, - "name": "REMOVE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "REMOVE" - }, - "name": "REMOVE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 519, - "column": 0, - "index": 13815 - }, - "end": { - "line": 523, - "column": 3, - "index": 13900 - } - }, - "context": { - "loc": { - "start": { - "line": 524, - "column": 0, - "index": 13901 - }, - "end": { - "line": 524, - "column": 40, - "index": 13941 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "REMOVE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "REMOVE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "REMOVE", - "type": { - "type": "StringLiteralType", - "value": "destination-out" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "REMOVE", - "kind": "typedef" - } - ], - "namespace": "REMOVE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "lighter" - }, - "name": "ADD" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "ADD" - }, - "name": "ADD" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 525, - "column": 0, - "index": 13942 - }, - "end": { - "line": 529, - "column": 3, - "index": 14010 - } - }, - "context": { - "loc": { - "start": { - "line": 530, - "column": 0, - "index": 14011 - }, - "end": { - "line": 530, - "column": 29, - "index": 14040 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "ADD", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "ADD" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "ADD", - "type": { - "type": "StringLiteralType", - "value": "lighter" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ADD", - "kind": "typedef" - } - ], - "namespace": "ADD" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "darken" - }, - "name": "DARKEST" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "DARKEST" - }, - "name": "DARKEST" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 531, - "column": 0, - "index": 14041 - }, - "end": { - "line": 535, - "column": 3, - "index": 14120 - } - }, - "context": { - "loc": { - "start": { - "line": 536, - "column": 0, - "index": 14121 - }, - "end": { - "line": 536, - "column": 32, - "index": 14153 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "DARKEST", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "DARKEST" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "DARKEST", - "type": { - "type": "StringLiteralType", - "value": "darken" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "DARKEST", - "kind": "typedef" - } - ], - "namespace": "DARKEST" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "lighten" - }, - "name": "LIGHTEST" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "LIGHTEST" - }, - "name": "LIGHTEST" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 537, - "column": 0, - "index": 14154 - }, - "end": { - "line": 541, - "column": 3, - "index": 14237 - } - }, - "context": { - "loc": { - "start": { - "line": 542, - "column": 0, - "index": 14238 - }, - "end": { - "line": 542, - "column": 34, - "index": 14272 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "LIGHTEST", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "LIGHTEST" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "LIGHTEST", - "type": { - "type": "StringLiteralType", - "value": "lighten" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "LIGHTEST", - "kind": "typedef" - } - ], - "namespace": "LIGHTEST" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "difference" - }, - "name": "DIFFERENCE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "DIFFERENCE" - }, - "name": "DIFFERENCE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 543, - "column": 0, - "index": 14273 - }, - "end": { - "line": 547, - "column": 3, - "index": 14365 - } - }, - "context": { - "loc": { - "start": { - "line": 548, - "column": 0, - "index": 14366 - }, - "end": { - "line": 548, - "column": 39, - "index": 14405 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "DIFFERENCE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "DIFFERENCE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "DIFFERENCE", - "type": { - "type": "StringLiteralType", - "value": "difference" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "DIFFERENCE", - "kind": "typedef" - } - ], - "namespace": "DIFFERENCE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "subtract" - }, - "name": "SUBTRACT" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "SUBTRACT" - }, - "name": "SUBTRACT" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 549, - "column": 0, - "index": 14406 - }, - "end": { - "line": 553, - "column": 3, - "index": 14490 - } - }, - "context": { - "loc": { - "start": { - "line": 554, - "column": 0, - "index": 14491 - }, - "end": { - "line": 554, - "column": 35, - "index": 14526 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "SUBTRACT", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "SUBTRACT" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "SUBTRACT", - "type": { - "type": "StringLiteralType", - "value": "subtract" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "SUBTRACT", - "kind": "typedef" - } - ], - "namespace": "SUBTRACT" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "exclusion" - }, - "name": "EXCLUSION" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "EXCLUSION" - }, - "name": "EXCLUSION" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 555, - "column": 0, - "index": 14527 - }, - "end": { - "line": 559, - "column": 3, - "index": 14615 - } - }, - "context": { - "loc": { - "start": { - "line": 560, - "column": 0, - "index": 14616 - }, - "end": { - "line": 560, - "column": 37, - "index": 14653 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "EXCLUSION", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "EXCLUSION" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "EXCLUSION", - "type": { - "type": "StringLiteralType", - "value": "exclusion" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "EXCLUSION", - "kind": "typedef" - } - ], - "namespace": "EXCLUSION" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "multiply" - }, - "name": "MULTIPLY" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "MULTIPLY" - }, - "name": "MULTIPLY" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 561, - "column": 0, - "index": 14654 - }, - "end": { - "line": 565, - "column": 3, - "index": 14738 - } - }, - "context": { - "loc": { - "start": { - "line": 566, - "column": 0, - "index": 14739 - }, - "end": { - "line": 566, - "column": 35, - "index": 14774 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "MULTIPLY", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "MULTIPLY" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "MULTIPLY", - "type": { - "type": "StringLiteralType", - "value": "multiply" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "MULTIPLY", - "kind": "typedef" - } - ], - "namespace": "MULTIPLY" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "screen" - }, - "name": "SCREEN" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "SCREEN" - }, - "name": "SCREEN" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 567, - "column": 0, - "index": 14775 - }, - "end": { - "line": 571, - "column": 3, - "index": 14851 - } - }, - "context": { - "loc": { - "start": { - "line": 572, - "column": 0, - "index": 14852 - }, - "end": { - "line": 572, - "column": 31, - "index": 14883 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "SCREEN", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "SCREEN" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "SCREEN", - "type": { - "type": "StringLiteralType", - "value": "screen" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "SCREEN", - "kind": "typedef" - } - ], - "namespace": "SCREEN" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "copy" - }, - "name": "REPLACE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "REPLACE" - }, - "name": "REPLACE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 573, - "column": 0, - "index": 14884 - }, - "end": { - "line": 577, - "column": 3, - "index": 14961 - } - }, - "context": { - "loc": { - "start": { - "line": 578, - "column": 0, - "index": 14962 - }, - "end": { - "line": 578, - "column": 30, - "index": 14992 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "REPLACE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "REPLACE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "REPLACE", - "type": { - "type": "StringLiteralType", - "value": "copy" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "REPLACE", - "kind": "typedef" - } - ], - "namespace": "REPLACE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "overlay" - }, - "name": "OVERLAY" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "OVERLAY" - }, - "name": "OVERLAY" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 579, - "column": 0, - "index": 14993 - }, - "end": { - "line": 583, - "column": 3, - "index": 15073 - } - }, - "context": { - "loc": { - "start": { - "line": 584, - "column": 0, - "index": 15074 - }, - "end": { - "line": 584, - "column": 33, - "index": 15107 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "OVERLAY", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "OVERLAY" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "OVERLAY", - "type": { - "type": "StringLiteralType", - "value": "overlay" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "OVERLAY", - "kind": "typedef" - } - ], - "namespace": "OVERLAY" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "hard-light" - }, - "name": "HARD_LIGHT" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "HARD_LIGHT" - }, - "name": "HARD_LIGHT" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 585, - "column": 0, - "index": 15108 - }, - "end": { - "line": 589, - "column": 3, - "index": 15200 - } - }, - "context": { - "loc": { - "start": { - "line": 590, - "column": 0, - "index": 15201 - }, - "end": { - "line": 590, - "column": 39, - "index": 15240 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "HARD_LIGHT", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "HARD_LIGHT" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "HARD_LIGHT", - "type": { - "type": "StringLiteralType", - "value": "hard-light" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "HARD_LIGHT", - "kind": "typedef" - } - ], - "namespace": "HARD_LIGHT" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "soft-light" - }, - "name": "SOFT_LIGHT" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "SOFT_LIGHT" - }, - "name": "SOFT_LIGHT" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 591, - "column": 0, - "index": 15241 - }, - "end": { - "line": 595, - "column": 3, - "index": 15333 - } - }, - "context": { - "loc": { - "start": { - "line": 596, - "column": 0, - "index": 15334 - }, - "end": { - "line": 596, - "column": 39, - "index": 15373 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "SOFT_LIGHT", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "SOFT_LIGHT" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "SOFT_LIGHT", - "type": { - "type": "StringLiteralType", - "value": "soft-light" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "SOFT_LIGHT", - "kind": "typedef" - } - ], - "namespace": "SOFT_LIGHT" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "color-dodge" - }, - "name": "DODGE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "DODGE" - }, - "name": "DODGE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 597, - "column": 0, - "index": 15374 - }, - "end": { - "line": 601, - "column": 3, - "index": 15452 - } - }, - "context": { - "loc": { - "start": { - "line": 602, - "column": 0, - "index": 15453 - }, - "end": { - "line": 602, - "column": 35, - "index": 15488 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "DODGE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "DODGE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "DODGE", - "type": { - "type": "StringLiteralType", - "value": "color-dodge" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "DODGE", - "kind": "typedef" - } - ], - "namespace": "DODGE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "color-burn" - }, - "name": "BURN" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "BURN" - }, - "name": "BURN" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 603, - "column": 0, - "index": 15489 - }, - "end": { - "line": 607, - "column": 3, - "index": 15563 - } - }, - "context": { - "loc": { - "start": { - "line": 608, - "column": 0, - "index": 15564 - }, - "end": { - "line": 608, - "column": 33, - "index": 15597 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "BURN", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "BURN" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "BURN", - "type": { - "type": "StringLiteralType", - "value": "color-burn" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "BURN", - "kind": "typedef" - } - ], - "namespace": "BURN" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "threshold" - }, - "name": "THRESHOLD" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "THRESHOLD" - }, - "name": "THRESHOLD" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 611, - "column": 0, - "index": 15610 - }, - "end": { - "line": 615, - "column": 3, - "index": 15698 - } - }, - "context": { - "loc": { - "start": { - "line": 616, - "column": 0, - "index": 15699 - }, - "end": { - "line": 616, - "column": 37, - "index": 15736 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "THRESHOLD", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "THRESHOLD" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "THRESHOLD", - "type": { - "type": "StringLiteralType", - "value": "threshold" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "THRESHOLD", - "kind": "typedef" - } - ], - "namespace": "THRESHOLD" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "gray" - }, - "name": "GRAY" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "GRAY" - }, - "name": "GRAY" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 617, - "column": 0, - "index": 15737 - }, - "end": { - "line": 621, - "column": 3, - "index": 15805 - } - }, - "context": { - "loc": { - "start": { - "line": 622, - "column": 0, - "index": 15806 - }, - "end": { - "line": 622, - "column": 27, - "index": 15833 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "GRAY", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "GRAY" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "GRAY", - "type": { - "type": "StringLiteralType", - "value": "gray" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "GRAY", - "kind": "typedef" - } - ], - "namespace": "GRAY" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "opaque" - }, - "name": "OPAQUE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "OPAQUE" - }, - "name": "OPAQUE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 623, - "column": 0, - "index": 15834 - }, - "end": { - "line": 627, - "column": 3, - "index": 15910 - } - }, - "context": { - "loc": { - "start": { - "line": 628, - "column": 0, - "index": 15911 - }, - "end": { - "line": 628, - "column": 31, - "index": 15942 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "OPAQUE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "OPAQUE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "OPAQUE", - "type": { - "type": "StringLiteralType", - "value": "opaque" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "OPAQUE", - "kind": "typedef" - } - ], - "namespace": "OPAQUE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "invert" - }, - "name": "INVERT" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "INVERT" - }, - "name": "INVERT" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 629, - "column": 0, - "index": 15943 - }, - "end": { - "line": 633, - "column": 3, - "index": 16019 - } - }, - "context": { - "loc": { - "start": { - "line": 634, - "column": 0, - "index": 16020 - }, - "end": { - "line": 634, - "column": 31, - "index": 16051 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "INVERT", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "INVERT" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "INVERT", - "type": { - "type": "StringLiteralType", - "value": "invert" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "INVERT", - "kind": "typedef" - } - ], - "namespace": "INVERT" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "posterize" - }, - "name": "POSTERIZE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "POSTERIZE" - }, - "name": "POSTERIZE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 635, - "column": 0, - "index": 16052 - }, - "end": { - "line": 639, - "column": 3, - "index": 16140 - } - }, - "context": { - "loc": { - "start": { - "line": 640, - "column": 0, - "index": 16141 - }, - "end": { - "line": 640, - "column": 37, - "index": 16178 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "POSTERIZE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "POSTERIZE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "POSTERIZE", - "type": { - "type": "StringLiteralType", - "value": "posterize" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "POSTERIZE", - "kind": "typedef" - } - ], - "namespace": "POSTERIZE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "dilate" - }, - "name": "DILATE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "DILATE" - }, - "name": "DILATE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 641, - "column": 0, - "index": 16179 - }, - "end": { - "line": 645, - "column": 3, - "index": 16255 - } - }, - "context": { - "loc": { - "start": { - "line": 646, - "column": 0, - "index": 16256 - }, - "end": { - "line": 646, - "column": 31, - "index": 16287 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "DILATE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "DILATE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "DILATE", - "type": { - "type": "StringLiteralType", - "value": "dilate" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "DILATE", - "kind": "typedef" - } - ], - "namespace": "DILATE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "erode" - }, - "name": "ERODE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "ERODE" - }, - "name": "ERODE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 647, - "column": 0, - "index": 16288 - }, - "end": { - "line": 651, - "column": 3, - "index": 16360 - } - }, - "context": { - "loc": { - "start": { - "line": 652, - "column": 0, - "index": 16361 - }, - "end": { - "line": 652, - "column": 29, - "index": 16390 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "ERODE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "ERODE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "ERODE", - "type": { - "type": "StringLiteralType", - "value": "erode" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ERODE", - "kind": "typedef" - } - ], - "namespace": "ERODE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "blur" - }, - "name": "BLUR" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "BLUR" - }, - "name": "BLUR" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 653, - "column": 0, - "index": 16391 - }, - "end": { - "line": 657, - "column": 3, - "index": 16459 - } - }, - "context": { - "loc": { - "start": { - "line": 658, - "column": 0, - "index": 16460 - }, - "end": { - "line": 658, - "column": 27, - "index": 16487 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "BLUR", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "BLUR" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "BLUR", - "type": { - "type": "StringLiteralType", - "value": "blur" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "BLUR", - "kind": "typedef" - } - ], - "namespace": "BLUR" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "normal" - }, - "name": "NORMAL" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "NORMAL" - }, - "name": "NORMAL" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 661, - "column": 0, - "index": 16503 - }, - "end": { - "line": 665, - "column": 3, - "index": 16579 - } - }, - "context": { - "loc": { - "start": { - "line": 666, - "column": 0, - "index": 16580 - }, - "end": { - "line": 666, - "column": 31, - "index": 16611 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "NORMAL", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "NORMAL" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "NORMAL", - "type": { - "type": "StringLiteralType", - "value": "normal" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "NORMAL", - "kind": "typedef" - } - ], - "namespace": "NORMAL" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "italic" - }, - "name": "ITALIC" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "ITALIC" - }, - "name": "ITALIC" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 667, - "column": 0, - "index": 16612 - }, - "end": { - "line": 671, - "column": 3, - "index": 16688 - } - }, - "context": { - "loc": { - "start": { - "line": 672, - "column": 0, - "index": 16689 - }, - "end": { - "line": 672, - "column": 31, - "index": 16720 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "ITALIC", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "ITALIC" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "ITALIC", - "type": { - "type": "StringLiteralType", - "value": "italic" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ITALIC", - "kind": "typedef" - } - ], - "namespace": "ITALIC" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "bold" - }, - "name": "BOLD" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "BOLD" - }, - "name": "BOLD" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 673, - "column": 0, - "index": 16721 - }, - "end": { - "line": 677, - "column": 3, - "index": 16789 - } - }, - "context": { - "loc": { - "start": { - "line": 678, - "column": 0, - "index": 16790 - }, - "end": { - "line": 678, - "column": 27, - "index": 16817 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "BOLD", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "BOLD" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "BOLD", - "type": { - "type": "StringLiteralType", - "value": "bold" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "BOLD", - "kind": "typedef" - } - ], - "namespace": "BOLD" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "bold italic" - }, - "name": "BOLDITALIC" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "BOLDITALIC" - }, - "name": "BOLDITALIC" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 679, - "column": 0, - "index": 16818 - }, - "end": { - "line": 683, - "column": 3, - "index": 16911 - } - }, - "context": { - "loc": { - "start": { - "line": 684, - "column": 0, - "index": 16912 - }, - "end": { - "line": 684, - "column": 40, - "index": 16952 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "BOLDITALIC", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "BOLDITALIC" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "BOLDITALIC", - "type": { - "type": "StringLiteralType", - "value": "bold italic" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "BOLDITALIC", - "kind": "typedef" - } - ], - "namespace": "BOLDITALIC" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "CHAR" - }, - "name": "CHAR" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CHAR" - }, - "name": "CHAR" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 685, - "column": 0, - "index": 16953 - }, - "end": { - "line": 689, - "column": 3, - "index": 17021 - } - }, - "context": { - "loc": { - "start": { - "line": 690, - "column": 0, - "index": 17022 - }, - "end": { - "line": 690, - "column": 27, - "index": 17049 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "CHAR", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CHAR" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "CHAR", - "type": { - "type": "StringLiteralType", - "value": "CHAR" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "CHAR", - "kind": "typedef" - } - ], - "namespace": "CHAR" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "WORD" - }, - "name": "WORD" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "WORD" - }, - "name": "WORD" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 691, - "column": 0, - "index": 17050 - }, - "end": { - "line": 695, - "column": 3, - "index": 17118 - } - }, - "context": { - "loc": { - "start": { - "line": 696, - "column": 0, - "index": 17119 - }, - "end": { - "line": 696, - "column": 27, - "index": 17146 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "WORD", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "WORD" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "WORD", - "type": { - "type": "StringLiteralType", - "value": "WORD" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "WORD", - "kind": "typedef" - } - ], - "namespace": "WORD" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "linear" - }, - "name": "LINEAR" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "LINEAR" - }, - "name": "LINEAR" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 704, - "column": 0, - "index": 17305 - }, - "end": { - "line": 708, - "column": 3, - "index": 17381 - } - }, - "context": { - "loc": { - "start": { - "line": 709, - "column": 0, - "index": 17382 - }, - "end": { - "line": 709, - "column": 31, - "index": 17413 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "LINEAR", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "LINEAR" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "LINEAR", - "type": { - "type": "StringLiteralType", - "value": "linear" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "LINEAR", - "kind": "typedef" - } - ], - "namespace": "LINEAR" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "quadratic" - }, - "name": "QUADRATIC" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "QUADRATIC" - }, - "name": "QUADRATIC" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 710, - "column": 0, - "index": 17414 - }, - "end": { - "line": 714, - "column": 3, - "index": 17502 - } - }, - "context": { - "loc": { - "start": { - "line": 715, - "column": 0, - "index": 17503 - }, - "end": { - "line": 715, - "column": 37, - "index": 17540 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "QUADRATIC", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "QUADRATIC" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "QUADRATIC", - "type": { - "type": "StringLiteralType", - "value": "quadratic" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "QUADRATIC", - "kind": "typedef" - } - ], - "namespace": "QUADRATIC" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "bezier" - }, - "name": "BEZIER" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "BEZIER" - }, - "name": "BEZIER" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 716, - "column": 0, - "index": 17541 - }, - "end": { - "line": 720, - "column": 3, - "index": 17617 - } - }, - "context": { - "loc": { - "start": { - "line": 721, - "column": 0, - "index": 17618 - }, - "end": { - "line": 721, - "column": 31, - "index": 17649 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "BEZIER", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "BEZIER" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "BEZIER", - "type": { - "type": "StringLiteralType", - "value": "bezier" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "BEZIER", - "kind": "typedef" - } - ], - "namespace": "BEZIER" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "curve" - }, - "name": "CURVE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CURVE" - }, - "name": "CURVE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 722, - "column": 0, - "index": 17650 - }, - "end": { - "line": 726, - "column": 3, - "index": 17722 - } - }, - "context": { - "loc": { - "start": { - "line": 727, - "column": 0, - "index": 17723 - }, - "end": { - "line": 727, - "column": 29, - "index": 17752 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "CURVE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CURVE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "CURVE", - "type": { - "type": "StringLiteralType", - "value": "curve" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "CURVE", - "kind": "typedef" - } - ], - "namespace": "CURVE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "stroke" - }, - "name": "STROKE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "STROKE" - }, - "name": "STROKE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 730, - "column": 0, - "index": 17773 - }, - "end": { - "line": 734, - "column": 3, - "index": 17849 - } - }, - "context": { - "loc": { - "start": { - "line": 735, - "column": 0, - "index": 17850 - }, - "end": { - "line": 735, - "column": 31, - "index": 17881 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "STROKE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "STROKE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "STROKE", - "type": { - "type": "StringLiteralType", - "value": "stroke" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "STROKE", - "kind": "typedef" - } - ], - "namespace": "STROKE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "fill" - }, - "name": "FILL" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "FILL" - }, - "name": "FILL" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 736, - "column": 0, - "index": 17882 - }, - "end": { - "line": 740, - "column": 3, - "index": 17950 - } - }, - "context": { - "loc": { - "start": { - "line": 741, - "column": 0, - "index": 17951 - }, - "end": { - "line": 741, - "column": 27, - "index": 17978 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "FILL", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "FILL" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "FILL", - "type": { - "type": "StringLiteralType", - "value": "fill" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "FILL", - "kind": "typedef" - } - ], - "namespace": "FILL" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "texture" - }, - "name": "TEXTURE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "TEXTURE" - }, - "name": "TEXTURE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 742, - "column": 0, - "index": 17979 - }, - "end": { - "line": 746, - "column": 3, - "index": 18059 - } - }, - "context": { - "loc": { - "start": { - "line": 747, - "column": 0, - "index": 18060 - }, - "end": { - "line": 747, - "column": 33, - "index": 18093 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "TEXTURE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "TEXTURE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "TEXTURE", - "type": { - "type": "StringLiteralType", - "value": "texture" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "TEXTURE", - "kind": "typedef" - } - ], - "namespace": "TEXTURE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "immediate" - }, - "name": "IMMEDIATE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "IMMEDIATE" - }, - "name": "IMMEDIATE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 748, - "column": 0, - "index": 18094 - }, - "end": { - "line": 752, - "column": 3, - "index": 18182 - } - }, - "context": { - "loc": { - "start": { - "line": 753, - "column": 0, - "index": 18183 - }, - "end": { - "line": 753, - "column": 37, - "index": 18220 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "IMMEDIATE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "IMMEDIATE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "IMMEDIATE", - "type": { - "type": "StringLiteralType", - "value": "immediate" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "IMMEDIATE", - "kind": "typedef" - } - ], - "namespace": "IMMEDIATE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "image" - }, - "name": "IMAGE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "IMAGE" - }, - "name": "IMAGE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 757, - "column": 0, - "index": 18284 - }, - "end": { - "line": 761, - "column": 3, - "index": 18356 - } - }, - "context": { - "loc": { - "start": { - "line": 762, - "column": 0, - "index": 18357 - }, - "end": { - "line": 762, - "column": 29, - "index": 18386 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "IMAGE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "IMAGE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "IMAGE", - "type": { - "type": "StringLiteralType", - "value": "image" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "IMAGE", - "kind": "typedef" - } - ], - "namespace": "IMAGE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "nearest" - }, - "name": "NEAREST" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "NEAREST" - }, - "name": "NEAREST" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 766, - "column": 0, - "index": 18455 - }, - "end": { - "line": 770, - "column": 3, - "index": 18535 - } - }, - "context": { - "loc": { - "start": { - "line": 771, - "column": 0, - "index": 18536 - }, - "end": { - "line": 771, - "column": 33, - "index": 18569 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "NEAREST", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "NEAREST" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "NEAREST", - "type": { - "type": "StringLiteralType", - "value": "nearest" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "NEAREST", - "kind": "typedef" - } - ], - "namespace": "NEAREST" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "repeat" - }, - "name": "REPEAT" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "REPEAT" - }, - "name": "REPEAT" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 772, - "column": 0, - "index": 18570 - }, - "end": { - "line": 776, - "column": 3, - "index": 18646 - } - }, - "context": { - "loc": { - "start": { - "line": 777, - "column": 0, - "index": 18647 - }, - "end": { - "line": 777, - "column": 31, - "index": 18678 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "REPEAT", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "REPEAT" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "REPEAT", - "type": { - "type": "StringLiteralType", - "value": "repeat" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "REPEAT", - "kind": "typedef" - } - ], - "namespace": "REPEAT" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "clamp" - }, - "name": "CLAMP" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CLAMP" - }, - "name": "CLAMP" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 778, - "column": 0, - "index": 18679 - }, - "end": { - "line": 782, - "column": 3, - "index": 18751 - } - }, - "context": { - "loc": { - "start": { - "line": 783, - "column": 0, - "index": 18752 - }, - "end": { - "line": 783, - "column": 29, - "index": 18781 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "CLAMP", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CLAMP" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "CLAMP", - "type": { - "type": "StringLiteralType", - "value": "clamp" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "CLAMP", - "kind": "typedef" - } - ], - "namespace": "CLAMP" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "mirror" - }, - "name": "MIRROR" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "MIRROR" - }, - "name": "MIRROR" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 784, - "column": 0, - "index": 18782 - }, - "end": { - "line": 788, - "column": 3, - "index": 18858 - } - }, - "context": { - "loc": { - "start": { - "line": 789, - "column": 0, - "index": 18859 - }, - "end": { - "line": 789, - "column": 31, - "index": 18890 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "MIRROR", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "MIRROR" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "MIRROR", - "type": { - "type": "StringLiteralType", - "value": "mirror" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "MIRROR", - "kind": "typedef" - } - ], - "namespace": "MIRROR" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "flat" - }, - "name": "FLAT" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "FLAT" - }, - "name": "FLAT" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 792, - "column": 0, - "index": 18918 - }, - "end": { - "line": 796, - "column": 3, - "index": 18986 - } - }, - "context": { - "loc": { - "start": { - "line": 797, - "column": 0, - "index": 18987 - }, - "end": { - "line": 797, - "column": 27, - "index": 19014 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "FLAT", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "FLAT" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "FLAT", - "type": { - "type": "StringLiteralType", - "value": "flat" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "FLAT", - "kind": "typedef" - } - ], - "namespace": "FLAT" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "smooth" - }, - "name": "SMOOTH" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "SMOOTH" - }, - "name": "SMOOTH" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 798, - "column": 0, - "index": 19015 - }, - "end": { - "line": 802, - "column": 3, - "index": 19091 - } - }, - "context": { - "loc": { - "start": { - "line": 803, - "column": 0, - "index": 19092 - }, - "end": { - "line": 803, - "column": 31, - "index": 19123 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "SMOOTH", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "SMOOTH" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "SMOOTH", - "type": { - "type": "StringLiteralType", - "value": "smooth" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "SMOOTH", - "kind": "typedef" - } - ], - "namespace": "SMOOTH" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "landscape" - }, - "name": "LANDSCAPE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "LANDSCAPE" - }, - "name": "LANDSCAPE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 806, - "column": 0, - "index": 19147 - }, - "end": { - "line": 810, - "column": 3, - "index": 19235 - } - }, - "context": { - "loc": { - "start": { - "line": 811, - "column": 0, - "index": 19236 - }, - "end": { - "line": 811, - "column": 37, - "index": 19273 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "LANDSCAPE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "LANDSCAPE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "LANDSCAPE", - "type": { - "type": "StringLiteralType", - "value": "landscape" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "LANDSCAPE", - "kind": "typedef" - } - ], - "namespace": "LANDSCAPE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "portrait" - }, - "name": "PORTRAIT" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "PORTRAIT" - }, - "name": "PORTRAIT" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 812, - "column": 0, - "index": 19274 - }, - "end": { - "line": 816, - "column": 3, - "index": 19358 - } - }, - "context": { - "loc": { - "start": { - "line": 817, - "column": 0, - "index": 19359 - }, - "end": { - "line": 817, - "column": 35, - "index": 19394 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "PORTRAIT", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "PORTRAIT" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "PORTRAIT", - "type": { - "type": "StringLiteralType", - "value": "portrait" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "PORTRAIT", - "kind": "typedef" - } - ], - "namespace": "PORTRAIT" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "grid" - }, - "name": "GRID" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "GRID" - }, - "name": "GRID" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 823, - "column": 0, - "index": 19491 - }, - "end": { - "line": 827, - "column": 3, - "index": 19559 - } - }, - "context": { - "loc": { - "start": { - "line": 828, - "column": 0, - "index": 19560 - }, - "end": { - "line": 828, - "column": 27, - "index": 19587 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "GRID", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "GRID" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "GRID", - "type": { - "type": "StringLiteralType", - "value": "grid" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "GRID", - "kind": "typedef" - } - ], - "namespace": "GRID" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "axes" - }, - "name": "AXES" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "AXES" - }, - "name": "AXES" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 830, - "column": 0, - "index": 19589 - }, - "end": { - "line": 834, - "column": 3, - "index": 19657 - } - }, - "context": { - "loc": { - "start": { - "line": 835, - "column": 0, - "index": 19658 - }, - "end": { - "line": 835, - "column": 27, - "index": 19685 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "AXES", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "AXES" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "AXES", - "type": { - "type": "StringLiteralType", - "value": "axes" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "AXES", - "kind": "typedef" - } - ], - "namespace": "AXES" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "label" - }, - "name": "LABEL" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "LABEL" - }, - "name": "LABEL" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 837, - "column": 0, - "index": 19687 - }, - "end": { - "line": 841, - "column": 3, - "index": 19759 - } - }, - "context": { - "loc": { - "start": { - "line": 842, - "column": 0, - "index": 19760 - }, - "end": { - "line": 842, - "column": 29, - "index": 19789 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "LABEL", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "LABEL" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "LABEL", - "type": { - "type": "StringLiteralType", - "value": "label" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "LABEL", - "kind": "typedef" - } - ], - "namespace": "LABEL" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "fallback" - }, - "name": "FALLBACK" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "FALLBACK" - }, - "name": "FALLBACK" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 843, - "column": 0, - "index": 19790 - }, - "end": { - "line": 847, - "column": 3, - "index": 19874 - } - }, - "context": { - "loc": { - "start": { - "line": 848, - "column": 0, - "index": 19875 - }, - "end": { - "line": 848, - "column": 35, - "index": 19910 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "FALLBACK", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "FALLBACK" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "FALLBACK", - "type": { - "type": "StringLiteralType", - "value": "fallback" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "FALLBACK", - "kind": "typedef" - } - ], - "namespace": "FALLBACK" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "contain" - }, - "name": "CONTAIN" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CONTAIN" - }, - "name": "CONTAIN" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 850, - "column": 0, - "index": 19912 - }, - "end": { - "line": 854, - "column": 3, - "index": 19992 - } - }, - "context": { - "loc": { - "start": { - "line": 855, - "column": 0, - "index": 19993 - }, - "end": { - "line": 855, - "column": 33, - "index": 20026 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "CONTAIN", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "CONTAIN" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "CONTAIN", - "type": { - "type": "StringLiteralType", - "value": "contain" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "CONTAIN", - "kind": "typedef" - } - ], - "namespace": "CONTAIN" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "cover" - }, - "name": "COVER" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "COVER" - }, - "name": "COVER" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 857, - "column": 0, - "index": 20028 - }, - "end": { - "line": 861, - "column": 3, - "index": 20100 - } - }, - "context": { - "loc": { - "start": { - "line": 862, - "column": 0, - "index": 20101 - }, - "end": { - "line": 862, - "column": 29, - "index": 20130 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "COVER", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "COVER" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "COVER", - "type": { - "type": "StringLiteralType", - "value": "cover" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "COVER", - "kind": "typedef" - } - ], - "namespace": "COVER" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "unsigned-byte" - }, - "name": "UNSIGNED_BYTE" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "UNSIGNED_BYTE" - }, - "name": "UNSIGNED_BYTE" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 864, - "column": 0, - "index": 20132 - }, - "end": { - "line": 868, - "column": 3, - "index": 20236 - } - }, - "context": { - "loc": { - "start": { - "line": 869, - "column": 0, - "index": 20237 - }, - "end": { - "line": 869, - "column": 45, - "index": 20282 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "UNSIGNED_BYTE", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "UNSIGNED_BYTE" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "UNSIGNED_BYTE", - "type": { - "type": "StringLiteralType", - "value": "unsigned-byte" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "UNSIGNED_BYTE", - "kind": "typedef" - } - ], - "namespace": "UNSIGNED_BYTE" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "unsigned-int" - }, - "name": "UNSIGNED_INT" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "UNSIGNED_INT" - }, - "name": "UNSIGNED_INT" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 871, - "column": 0, - "index": 20284 - }, - "end": { - "line": 875, - "column": 3, - "index": 20384 - } - }, - "context": { - "loc": { - "start": { - "line": 876, - "column": 0, - "index": 20385 - }, - "end": { - "line": 876, - "column": 43, - "index": 20428 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "UNSIGNED_INT", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "UNSIGNED_INT" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "UNSIGNED_INT", - "type": { - "type": "StringLiteralType", - "value": "unsigned-int" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "UNSIGNED_INT", - "kind": "typedef" - } - ], - "namespace": "UNSIGNED_INT" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "float" - }, - "name": "FLOAT" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "FLOAT" - }, - "name": "FLOAT" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 878, - "column": 0, - "index": 20430 - }, - "end": { - "line": 882, - "column": 3, - "index": 20502 - } - }, - "context": { - "loc": { - "start": { - "line": 883, - "column": 0, - "index": 20503 - }, - "end": { - "line": 883, - "column": 29, - "index": 20532 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "FLOAT", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "FLOAT" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "FLOAT", - "type": { - "type": "StringLiteralType", - "value": "float" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "FLOAT", - "kind": "typedef" - } - ], - "namespace": "FLOAT" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "half-float" - }, - "name": "HALF_FLOAT" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "HALF_FLOAT" - }, - "name": "HALF_FLOAT" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 885, - "column": 0, - "index": 20534 - }, - "end": { - "line": 889, - "column": 3, - "index": 20626 - } - }, - "context": { - "loc": { - "start": { - "line": 890, - "column": 0, - "index": 20627 - }, - "end": { - "line": 890, - "column": 39, - "index": 20666 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "HALF_FLOAT", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "HALF_FLOAT" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "HALF_FLOAT", - "type": { - "type": "StringLiteralType", - "value": "half-float" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "HALF_FLOAT", - "kind": "typedef" - } - ], - "namespace": "HALF_FLOAT" - }, - { - "description": "", - "tags": [ - { - "title": "typedef", - "description": null, - "lineNumber": 1, - "type": { - "type": "StringLiteralType", - "value": "rgba" - }, - "name": "RGBA" - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "RGBA" - }, - "name": "RGBA" - }, - { - "title": "final", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 892, - "column": 0, - "index": 20668 - }, - "end": { - "line": 896, - "column": 3, - "index": 20736 - } - }, - "context": { - "loc": { - "start": { - "line": 897, - "column": 0, - "index": 20737 - }, - "end": { - "line": 897, - "column": 27, - "index": 20764 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/constants.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "RGBA", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "RGBA" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "typedef", - "name": "RGBA", - "type": { - "type": "StringLiteralType", - "value": "rgba" - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "RGBA", - "kind": "typedef" - } - ], - "namespace": "RGBA" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Displays text in the web browser's console." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "print()" - }, - { - "type": "text", - "value": " is helpful for printing values while debugging. Each call to\n" - }, - { - "type": "inlineCode", - "value": "print()" - }, - { - "type": "text", - "value": " creates a new line of text." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: Call " - }, - { - "type": "inlineCode", - "value": "print('\\n')" - }, - { - "type": "text", - "value": " to print a blank line. Calling " - }, - { - "type": "inlineCode", - "value": "print()" - }, - { - "type": "text", - "value": " without\nan argument opens the browser's dialog for printing documents." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "print" - }, - { - "title": "param", - "description": "content to print to the console.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Any" - }, - "name": "contents" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 21, - "column": 0, - "index": 438 - }, - "end": { - "line": 51, - "column": 3, - "index": 1188 - } - }, - "context": { - "loc": { - "start": { - "line": 52, - "column": 0, - "index": 1189 - }, - "end": { - "line": 67, - "column": 2, - "index": 1551 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "contents", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "content to print to the console." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Any" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "print", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "print", - "kind": "function" - } - ], - "namespace": "print" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes data to the PrintWriter stream, and adds a new line at the end" - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 2, - "name": "print" - }, - { - "title": "param", - "description": "all data to be printed by the PrintWriter", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "data" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 1227, - "column": 2, - "index": 37056 - }, - "end": { - "line": 1264, - "column": 5, - "index": 37976 - } - }, - "context": { - "loc": { - "start": { - "line": 1265, - "column": 2, - "index": 37979 - }, - "end": { - "line": 1267, - "column": 4, - "index": 38046 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "data", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "all data to be printed by the PrintWriter" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "print", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "print", - "kind": "function" - } - ], - "namespace": "print" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Changes the cursor's appearance." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "type" - }, - { - "type": "text", - "value": ", sets the type of cursor to display. The\nbuilt-in options are " - }, - { - "type": "inlineCode", - "value": "ARROW" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "CROSS" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "HAND" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "MOVE" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "TEXT" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "WAIT" - }, - { - "type": "text", - "value": ".\n" - }, - { - "type": "inlineCode", - "value": "cursor()" - }, - { - "type": "text", - "value": " also recognizes standard CSS cursor properties passed as\nstrings: " - }, - { - "type": "inlineCode", - "value": "'help'" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "'wait'" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "'crosshair'" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "'not-allowed'" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "'zoom-in'" - }, - { - "type": "text", - "value": ",\nand " - }, - { - "type": "inlineCode", - "value": "'grab'" - }, - { - "type": "text", - "value": ". If the path to an image is passed, as in\n" - }, - { - "type": "inlineCode", - "value": "cursor('assets/target.png')" - }, - { - "type": "text", - "value": ", then the image will be used as the cursor.\nImages must be in .cur, .gif, .jpg, .jpeg, or .png format." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The parameters " - }, - { - "type": "inlineCode", - "value": "x" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "y" - }, - { - "type": "text", - "value": " are optional. If an image is used for the\ncursor, " - }, - { - "type": "inlineCode", - "value": "x" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "y" - }, - { - "type": "text", - "value": " 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. " - }, - { - "type": "inlineCode", - "value": "x" - }, - { - "type": "text", - "value": "\nand " - }, - { - "type": "inlineCode", - "value": "y" - }, - { - "type": "text", - "value": " must be less than the image's width and height, respectively." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 16, - "name": "cursor" - }, - { - "title": "param", - "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.", - "lineNumber": 17, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "ARROW" - }, - { - "type": "NameExpression", - "name": "CROSS" - }, - { - "type": "NameExpression", - "name": "HAND" - }, - { - "type": "NameExpression", - "name": "MOVE" - }, - { - "type": "NameExpression", - "name": "TEXT" - }, - { - "type": "NameExpression", - "name": "WAIT" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "type" - }, - { - "title": "param", - "description": "horizontal active spot of the cursor.", - "lineNumber": 20, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "x" - }, - { - "title": "param", - "description": "vertical active spot of the cursor.", - "lineNumber": 21, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "y" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 193, - "column": 0, - "index": 4303 - }, - "end": { - "line": 271, - "column": 3, - "index": 6952 - } - }, - "context": { - "loc": { - "start": { - "line": 272, - "column": 0, - "index": 6953 - }, - "end": { - "line": 300, - "column": 2, - "index": 7961 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "type", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Built-in: either ARROW, CROSS, HAND, MOVE, TEXT, or WAIT.\nNative CSS properties: 'grab', 'progress', and so on.\nPath to cursor image." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "ARROW" - }, - { - "type": "NameExpression", - "name": "CROSS" - }, - { - "type": "NameExpression", - "name": "HAND" - }, - { - "type": "NameExpression", - "name": "MOVE" - }, - { - "type": "NameExpression", - "name": "TEXT" - }, - { - "type": "NameExpression", - "name": "WAIT" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "param", - "name": "x", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "horizontal active spot of the cursor." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 21, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "vertical active spot of the cursor." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "cursor", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "cursor", - "kind": "function" - } - ], - "namespace": "cursor" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the number of frames to draw per second." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "inlineCode", - "value": "frameRate()" - }, - { - "type": "text", - "value": " with one numeric argument, as in " - }, - { - "type": "inlineCode", - "value": "frameRate(30)" - }, - { - "type": "text", - "value": ",\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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "inlineCode", - "value": "frameRate()" - }, - { - "type": "text", - "value": " without an argument returns the current frame rate.\nThe value returned is an approximation." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 12, - "name": "frameRate" - }, - { - "title": "param", - "description": "number of frames to draw per second.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "fps" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 14 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 16 - } - ], - "loc": { - "start": { - "line": 302, - "column": 0, - "index": 7963 - }, - "end": { - "line": 367, - "column": 3, - "index": 9712 - } - }, - "context": { - "loc": { - "start": { - "line": 372, - "column": 0, - "index": 9788 - }, - "end": { - "line": 383, - "column": 2, - "index": 10104 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fps", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of frames to draw per second." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "frameRate", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "frameRate", - "kind": "function" - } - ], - "namespace": "frameRate" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "frameRate" - }, - { - "title": "return", - "description": "current frame rate.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "loc": { - "start": { - "line": 368, - "column": 0, - "index": 9713 - }, - "end": { - "line": 371, - "column": 3, - "index": 9787 - } - }, - "context": { - "loc": { - "start": { - "line": 372, - "column": 0, - "index": 9788 - }, - "end": { - "line": 383, - "column": 2, - "index": 10104 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "current frame rate." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "frameRate", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "frameRate", - "kind": "function" - } - ], - "namespace": "frameRate" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the target frame rate. The value is either the system frame rate or\nthe last value passed to " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "frameRate()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "getTargetFrameRate" - }, - { - "title": "return", - "description": "_targetFrameRate", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 411, - "column": 0, - "index": 10913 - }, - "end": { - "line": 435, - "column": 3, - "index": 11492 - } - }, - "context": { - "loc": { - "start": { - "line": 436, - "column": 0, - "index": 11493 - }, - "end": { - "line": 438, - "column": 2, - "index": 11574 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "_targetFrameRate" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "getTargetFrameRate", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "getTargetFrameRate", - "kind": "function" - } - ], - "namespace": "getTargetFrameRate" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Hides the cursor from view." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 3, - "name": "noCursor" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 440, - "column": 0, - "index": 11576 - }, - "end": { - "line": 461, - "column": 3, - "index": 11967 - } - }, - "context": { - "loc": { - "start": { - "line": 462, - "column": 0, - "index": 11968 - }, - "end": { - "line": 464, - "column": 2, - "index": 12053 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "noCursor", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "noCursor", - "kind": "function" - } - ], - "namespace": "noCursor" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The code in " - }, - { - "type": "inlineCode", - "value": "windowResized()" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "inlineCode", - "value": "event" - }, - { - "type": "text", - "value": " parameter is optional. If added to the function definition, it\ncan be used for debugging or other purposes." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "windowResized" - }, - { - "title": "param", - "description": "optional resize Event.", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "UIEvent" - } - }, - "name": "event" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "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
", - "lineNumber": 30 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 55 - } - ], - "loc": { - "start": { - "line": 661, - "column": 0, - "index": 16868 - }, - "end": { - "line": 718, - "column": 3, - "index": 18384 - } - }, - "context": { - "loc": { - "start": { - "line": 719, - "column": 0, - "index": 18385 - }, - "end": { - "line": 730, - "column": 2, - "index": 18803 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "event", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional resize Event." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "UIEvent" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "windowResized", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "windowResized", - "kind": "function" - } - ], - "namespace": "windowResized" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Toggles full-screen mode or returns the current mode." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "inlineCode", - "value": "fullscreen(true)" - }, - { - "type": "text", - "value": " makes the sketch full-screen. Calling\n" - }, - { - "type": "inlineCode", - "value": "fullscreen(false)" - }, - { - "type": "text", - "value": " makes the sketch its original size." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "inlineCode", - "value": "fullscreen()" - }, - { - "type": "text", - "value": " without an argument returns " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": " if the sketch\nis in full-screen mode and " - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " if not." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: Due to browser restrictions, " - }, - { - "type": "inlineCode", - "value": "fullscreen()" - }, - { - "type": "text", - "value": " can only be called with\nuser input such as a mouse press." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 12, - "name": "fullscreen" - }, - { - "title": "param", - "description": "whether the sketch should be in fullscreen mode.", - "lineNumber": 13, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - }, - "name": "val" - }, - { - "title": "return", - "description": "current fullscreen state.", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 15 - } - ], - "loc": { - "start": { - "line": 888, - "column": 0, - "index": 22273 - }, - "end": { - "line": 922, - "column": 3, - "index": 23294 - } - }, - "context": { - "loc": { - "start": { - "line": 923, - "column": 0, - "index": 23295 - }, - "end": { - "line": 941, - "column": 2, - "index": 23807 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "val", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "whether the sketch should be in fullscreen mode." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "current fullscreen state." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "fullscreen", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "fullscreen", - "kind": "function" - } - ], - "namespace": "fullscreen" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the pixel scaling for high pixel density displays." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "By default, the pixel density is set to match display density. Calling\n" - }, - { - "type": "inlineCode", - "value": "pixelDensity(1)" - }, - { - "type": "text", - "value": " turn this off." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "inlineCode", - "value": "pixelDensity()" - }, - { - "type": "text", - "value": " without an argument returns the current pixel\ndensity." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "pixelDensity" - }, - { - "title": "param", - "description": "desired pixel density.", - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "val" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 943, - "column": 0, - "index": 23809 - }, - "end": { - "line": 990, - "column": 3, - "index": 24843 - } - }, - "context": { - "loc": { - "start": { - "line": 995, - "column": 0, - "index": 24934 - }, - "end": { - "line": 1008, - "column": 2, - "index": 25360 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "val", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "desired pixel density." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "pixelDensity", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "pixelDensity", - "kind": "function" - } - ], - "namespace": "pixelDensity" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "pixelDensity" - }, - { - "title": "returns", - "description": "current pixel density of the sketch.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "loc": { - "start": { - "line": 991, - "column": 0, - "index": 24844 - }, - "end": { - "line": 994, - "column": 3, - "index": 24933 - } - }, - "context": { - "loc": { - "start": { - "line": 995, - "column": 0, - "index": 24934 - }, - "end": { - "line": 1008, - "column": 2, - "index": 25360 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "current pixel density of the sketch." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "pixelDensity", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "pixelDensity", - "kind": "function" - } - ], - "namespace": "pixelDensity" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the display's current pixel density." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 3, - "name": "displayDensity" - }, - { - "title": "returns", - "description": "current pixel density of the display.", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 1010, - "column": 0, - "index": 25362 - }, - "end": { - "line": 1046, - "column": 3, - "index": 26211 - } - }, - "context": { - "loc": { - "start": { - "line": 1047, - "column": 0, - "index": 26212 - }, - "end": { - "line": 1047, - "column": 60, - "index": 26272 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "current pixel density of the display." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "displayDensity", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "displayDensity", - "kind": "function" - } - ], - "namespace": "displayDensity" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the sketch's current\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "URL" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nas a string." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "getURL" - }, - { - "title": "return", - "description": "url", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 1081, - "column": 0, - "index": 27220 - }, - "end": { - "line": 1104, - "column": 3, - "index": 27789 - } - }, - "context": { - "loc": { - "start": { - "line": 1105, - "column": 0, - "index": 27790 - }, - "end": { - "line": 1105, - "column": 42, - "index": 27832 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "url" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "getURL", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "getURL", - "kind": "function" - } - ], - "namespace": "getURL" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the current\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "URL" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\npath as an array of strings." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "For example, consider a sketch hosted at the URL\n" - }, - { - "type": "inlineCode", - "value": "https://example.com/sketchbook" - }, - { - "type": "text", - "value": ". Calling " - }, - { - "type": "inlineCode", - "value": "getURLPath()" - }, - { - "type": "text", - "value": " returns\n" - }, - { - "type": "inlineCode", - "value": "['sketchbook']" - }, - { - "type": "text", - "value": ". For a sketch hosted at the URL\n" - }, - { - "type": "inlineCode", - "value": "https://example.com/sketchbook/monday" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "getURLPath()" - }, - { - "type": "text", - "value": " returns\n" - }, - { - "type": "inlineCode", - "value": "['sketchbook', 'monday']" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 11, - "name": "getURLPath" - }, - { - "title": "return", - "description": "path components.", - "lineNumber": 12, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 1107, - "column": 0, - "index": 27834 - }, - "end": { - "line": 1136, - "column": 3, - "index": 28700 - } - }, - "context": { - "loc": { - "start": { - "line": 1137, - "column": 0, - "index": 28701 - }, - "end": { - "line": 1138, - "column": 53, - "index": 28786 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "path components." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "getURLPath", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "getURLPath", - "kind": "function" - } - ], - "namespace": "getURLPath" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the current\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "URL parameters" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nin an Object." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "For example, calling " - }, - { - "type": "inlineCode", - "value": "getURLParams()" - }, - { - "type": "text", - "value": " in a sketch hosted at the URL\n" - }, - { - "type": "inlineCode", - "value": "http://p5js.org?year=2014&month=May&day=15" - }, - { - "type": "text", - "value": " returns\n" - }, - { - "type": "inlineCode", - "value": "{ year: 2014, month: 'May', day: 15 }" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "getURLParams" - }, - { - "title": "return", - "description": "URL params", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - }, - { - "title": "alt", - "description": "This example does not render anything.", - "lineNumber": 33 - } - ], - "loc": { - "start": { - "line": 1140, - "column": 0, - "index": 28788 - }, - "end": { - "line": 1175, - "column": 3, - "index": 29804 - } - }, - "context": { - "loc": { - "start": { - "line": 1176, - "column": 0, - "index": 29805 - }, - "end": { - "line": 1187, - "column": 2, - "index": 30072 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/environment.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "URL params" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "getURLParams", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "getURLParams", - "kind": "function" - } - ], - "namespace": "getURLParams" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Prints out all the colors in the color pallete with white text.\nFor color blindness testing." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 934, - "column": 2, - "index": 32166 - }, - "end": { - "line": 937, - "column": 5, - "index": 32278 - } - }, - "context": { - "loc": { - "start": { - "line": 932, - "column": 2, - "index": 32088 - }, - "end": { - "line": 932, - "column": 76, - "index": 32162 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/friendly_errors/fes_core.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [], - "namespace": "" - }, - { - "description": "", - "tags": [ - { - "title": "requires", - "description": null, - "lineNumber": 1, - "name": "constants" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 3, - "column": 3, - "index": 30 - } - }, - "context": { - "loc": { - "start": { - "line": 5, - "column": 0, - "index": 32 - }, - "end": { - "line": 5, - "column": 41, - "index": 73 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/helpers.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "constants", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "constants" - } - ], - "namespace": "constants" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Structure" - }, - { - "title": "submodule", - "description": "Structure", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "constants" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 86 - } - }, - "context": { - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 124 - }, - "end": { - "line": 9, - "column": 41, - "index": 165 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Structure", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Structure", - "kind": "module" - } - ], - "namespace": "Structure" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Structure" - }, - { - "title": "submodule", - "description": "Structure", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 81 - } - }, - "context": { - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 83 - }, - "end": { - "line": 8, - "column": 24, - "index": 107 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/structure.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Structure", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Structure", - "kind": "module" - } - ], - "namespace": "Structure" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Called directly before " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "preload()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is used to handle\nasynchronous loading of external files in a blocking way. If a preload\nfunction is defined, " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " will wait until any load calls within have\nfinished. Nothing besides load calls (" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadImage" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadJSON" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadFont" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadStrings" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", etc.) should be inside the preload function. If asynchronous\nloading is preferred, the load methods can instead be called in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nor anywhere else with the use of a callback parameter." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "here" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 13, - "name": "preload" - }, - { - "title": "for", - "description": "p5", - "lineNumber": 14 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 15 - }, - { - "title": "alt", - "description": "nothing displayed", - "lineNumber": 37 - } - ], - "loc": { - "start": { - "line": 624, - "column": 0, - "index": 21206 - }, - "end": { - "line": 664, - "column": 3, - "index": 22652 - } - }, - "context": { - "loc": { - "start": { - "line": 752, - "column": 0, - "index": 26017 - }, - "end": { - "line": 752, - "column": 19, - "index": 26036 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "preload", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "preload", - "kind": "function" - } - ], - "namespace": "preload" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function for each program and it shouldn't\nbe called again after its initial execution." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: Variables declared within " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " are not accessible within other\nfunctions, including " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 10, - "name": "setup" - }, - { - "title": "for", - "description": "p5", - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - }, - { - "title": "alt", - "description": "nothing displayed", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 666, - "column": 0, - "index": 22654 - }, - "end": { - "line": 696, - "column": 3, - "index": 23493 - } - }, - "context": { - "loc": { - "start": { - "line": 752, - "column": 0, - "index": 26017 - }, - "end": { - "line": 752, - "column": 19, - "index": 26036 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "setup", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setup", - "kind": "function" - } - ], - "namespace": "setup" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Called directly after " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function continuously executes\nthe lines of code contained inside its block until the program is stopped\nor " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noLoop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is called. Note if " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noLoop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is called in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " will\nstill be executed once before stopping. " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is called automatically and\nshould never be called explicitly." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "It should always be controlled with " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noLoop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "redraw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". After\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noLoop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " stops the code in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " from executing, " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "redraw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " causes the\ncode inside " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to execute once, and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " will cause the code\ninside " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to resume executing continuously." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The number of times " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " executes in each second may be controlled with\nthe " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "frameRate()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "There can only be one " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function for each sketch, and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " must\nexist if you want the code to run continuously, or to process events such\nas " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "mousePressed()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". Sometimes, you might have an empty call to " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " in\nyour program, as shown in the above example." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "It is important to note that the drawing coordinate system will be reset\nat the beginning of each " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " call. If any transformations are performed\nwithin " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " (ex: scale, rotate, translate), their effects will be\nundone at the beginning of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", so transformations will not accumulate\nover time. On the other hand, styling applied (ex: fill, stroke, etc) will\nremain in effect." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5", - "lineNumber": 27 - }, - { - "title": "method", - "description": null, - "lineNumber": 28, - "name": "draw" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 29 - }, - { - "title": "alt", - "description": "nothing displayed", - "lineNumber": 47 - } - ], - "loc": { - "start": { - "line": 698, - "column": 0, - "index": 23495 - }, - "end": { - "line": 748, - "column": 3, - "index": 25934 - } - }, - "context": { - "loc": { - "start": { - "line": 752, - "column": 0, - "index": 26017 - }, - "end": { - "line": 752, - "column": 19, - "index": 26036 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/main.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "draw", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "draw", - "kind": "function" - } - ], - "namespace": "draw" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "DOM" - }, - { - "title": "submodule", - "description": "DOM", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5.Element", - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 5, - "column": 3, - "index": 59 - } - }, - "context": { - "loc": { - "start": { - "line": 7, - "column": 0, - "index": 61 - }, - "end": { - "line": 7, - "column": 24, - "index": 85 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "DOM", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "DOM", - "kind": "module" - } - ], - "namespace": "DOM" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The web is much more than just canvas and the DOM functionality makes it easy to interact\nwith other HTML5 objects, including text, hyperlink, image, input, video,\naudio, and webcam.\nThere is a set of creation methods, DOM manipulation methods, and\nan extended " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " that supports a range of HTML elements. See the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nbeyond the canvas tutorial" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for a full overview of how this addon works." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "tutorial: beyond the canvas" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfor more info on how to use this library." - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 12, - "type": null, - "name": "DOM" - }, - { - "title": "submodule", - "description": "DOM", - "lineNumber": 13 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 14 - }, - { - "title": "requires", - "description": null, - "lineNumber": 15, - "name": "p5" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 17, - "column": 3, - "index": 744 - } - }, - "context": { - "loc": { - "start": { - "line": 19, - "column": 0, - "index": 746 - }, - "end": { - "line": 19, - "column": 30, - "index": 776 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "DOM", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "DOM", - "kind": "module" - } - ], - "namespace": "DOM" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A class to describe an\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "HTML element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nSketches can use many elements. Common elements include the drawing canvas,\nbuttons, sliders, webcam feeds, and so on." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "All elements share the methods of the " - }, - { - "type": "inlineCode", - "value": "p5.Element" - }, - { - "type": "text", - "value": " class. They're created\nwith functions such as " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createButton()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 10, - "type": null, - "name": "p5.Element" - }, - { - "title": "param", - "description": "wrapped DOM element.", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "HTMLElement" - }, - "name": "elt" - }, - { - "title": "param", - "description": "pointer to p5 instance.", - "lineNumber": 12, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5" - } - }, - "name": "pInst" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 87 - }, - "end": { - "line": 51, - "column": 3, - "index": 1410 - } - }, - "context": { - "loc": { - "start": { - "line": 52, - "column": 0, - "index": 1411 - }, - "end": { - "line": 1211, - "column": 2, - "index": 32634 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "elt", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "wrapped DOM element." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "HTMLElement" - } - }, - { - "title": "param", - "name": "pInst", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pointer to p5 instance." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "class", - "name": "p5.Element", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.Element", - "kind": "class" - } - ], - "namespace": "p5.Element" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Underlying\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "HTMLElement" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nobject. Its properties and methods can be used directly." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - }, - { - "title": "property", - "description": null, - "lineNumber": 24, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "elt" - }, - { - "title": "for", - "description": "p5.Element", - "lineNumber": 25 - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 26 - } - ], - "loc": { - "start": { - "line": 1213, - "column": 0, - "index": 32636 - }, - "end": { - "line": 1240, - "column": 3, - "index": 33269 - } - }, - "context": { - "loc": { - "start": { - "line": 1254, - "column": 0, - "index": 33402 - }, - "end": { - "line": 1254, - "column": 26, - "index": 33428 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "p5.Element", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.Element" - } - ], - "namespace": "p5.Element" - }, - { - "description": "", - "tags": [ - { - "title": "type", - "description": null, - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "width" - }, - { - "title": "for", - "description": "p5.Element", - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 1242, - "column": 0, - "index": 33271 - }, - "end": { - "line": 1246, - "column": 3, - "index": 33334 - } - }, - "context": { - "loc": { - "start": { - "line": 1254, - "column": 0, - "index": 33402 - }, - "end": { - "line": 1254, - "column": 26, - "index": 33428 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "p5.Element", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.Element" - } - ], - "namespace": "p5.Element" - }, - { - "description": "", - "tags": [ - { - "title": "type", - "description": null, - "lineNumber": 1, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "property", - "description": null, - "lineNumber": 2, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "height" - }, - { - "title": "for", - "description": "p5.Element", - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 1248, - "column": 0, - "index": 33336 - }, - "end": { - "line": 1252, - "column": 3, - "index": 33400 - } - }, - "context": { - "loc": { - "start": { - "line": 1254, - "column": 0, - "index": 33402 - }, - "end": { - "line": 1254, - "column": 26, - "index": 33428 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Element.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "p5.Element", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.Element" - } - ], - "namespace": "p5.Element" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Rendering" - }, - { - "title": "submodule", - "description": "Rendering", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 5, - "column": 3, - "index": 63 - } - }, - "context": { - "loc": { - "start": { - "line": 7, - "column": 0, - "index": 65 - }, - "end": { - "line": 7, - "column": 24, - "index": 89 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Graphics.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Rendering", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Rendering", - "kind": "module" - } - ], - "namespace": "Rendering" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Rendering" - }, - { - "title": "submodule", - "description": "Rendering", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 5, - "column": 3, - "index": 63 - } - }, - "context": { - "loc": { - "start": { - "line": 7, - "column": 0, - "index": 65 - }, - "end": { - "line": 7, - "column": 24, - "index": 89 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Renderer.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Rendering", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Rendering", - "kind": "module" - } - ], - "namespace": "Rendering" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Rendering" - }, - { - "title": "submodule", - "description": "Rendering", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 5, - "column": 3, - "index": 63 - } - }, - "context": { - "loc": { - "start": { - "line": 7, - "column": 0, - "index": 65 - }, - "end": { - "line": 7, - "column": 24, - "index": 89 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/rendering.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Rendering", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Rendering", - "kind": "module" - } - ], - "namespace": "Rendering" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Rendering" - }, - { - "title": "requires", - "description": null, - "lineNumber": 2, - "name": "constants" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 4, - "column": 3, - "index": 51 - } - }, - "context": { - "loc": { - "start": { - "line": 6, - "column": 0, - "index": 53 - }, - "end": { - "line": 6, - "column": 30, - "index": 83 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Framebuffer.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Rendering", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Rendering", - "kind": "module" - } - ], - "namespace": "Rendering" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Rendering" - }, - { - "title": "submodule", - "description": "Rendering", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 107, - "column": 0, - "index": 3656 - }, - "end": { - "line": 111, - "column": 3, - "index": 3719 - } - }, - "context": { - "loc": { - "start": { - "line": 261, - "column": 0, - "index": 7617 - }, - "end": { - "line": 311, - "column": 2, - "index": 9029 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Rendering", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Rendering", - "kind": "module" - } - ], - "namespace": "Rendering" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 7, - "type": null, - "name": "p5.Graphics" - }, - { - "title": "extends", - "description": null, - "lineNumber": 8, - "type": null, - "name": "p5.Element" - }, - { - "title": "param", - "description": "width", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "w" - }, - { - "title": "param", - "description": "height", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "h" - }, - { - "title": "param", - "description": "the renderer to use, either P2D or WEBGL", - "lineNumber": 11, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "P2D" - }, - { - "type": "NameExpression", - "name": "WEBGL" - } - ] - }, - "name": "renderer" - }, - { - "title": "param", - "description": "pointer to p5 instance", - "lineNumber": 12, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5" - } - }, - "name": "pInst" - }, - { - "title": "param", - "description": "existing html canvas element", - "lineNumber": 13, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "HTMLCanvasElement" - } - }, - "name": "canvas" - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 133 - }, - "end": { - "line": 24, - "column": 3, - "index": 789 - } - }, - "context": { - "loc": { - "start": { - "line": 25, - "column": 0, - "index": 790 - }, - "end": { - "line": 201, - "column": 2, - "index": 5351 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Graphics.js" - }, - "augments": [ - { - "title": "extends", - "description": null, - "lineNumber": 8, - "type": null, - "name": "p5.Element" - } - ], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "w", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "width" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "h", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "height" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "renderer", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the renderer to use, either P2D or WEBGL" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "P2D" - }, - { - "type": "NameExpression", - "name": "WEBGL" - } - ] - } - }, - { - "title": "param", - "name": "pInst", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pointer to p5 instance" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5" - } - } - }, - { - "title": "param", - "name": "canvas", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "existing html canvas element" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "HTMLCanvasElement" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "class", - "name": "p5.Graphics", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.Graphics", - "kind": "class" - } - ], - "namespace": "p5.Graphics" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 5, - "type": null, - "name": "p5.Renderer" - }, - { - "title": "extends", - "description": null, - "lineNumber": 6, - "type": null, - "name": "p5.Element" - }, - { - "title": "param", - "description": "DOM node that is wrapped", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "HTMLElement" - }, - "name": "elt" - }, - { - "title": "param", - "description": "pointer to p5 instance", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5" - } - }, - "name": "pInst" - }, - { - "title": "param", - "description": "whether we're using it as main canvas", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - }, - "name": "isMainCanvas" - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 139 - }, - "end": { - "line": 20, - "column": 3, - "index": 551 - } - }, - "context": { - "loc": { - "start": { - "line": 21, - "column": 0, - "index": 552 - }, - "end": { - "line": 518, - "column": 2, - "index": 14975 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Renderer.js" - }, - "augments": [ - { - "title": "extends", - "description": null, - "lineNumber": 6, - "type": null, - "name": "p5.Element" - } - ], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "elt", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "DOM node that is wrapped" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "HTMLElement" - } - }, - { - "title": "param", - "name": "pInst", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pointer to p5 instance" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5" - } - } - }, - { - "title": "param", - "name": "isMainCanvas", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "whether we're using it as main canvas" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "class", - "name": "p5.Renderer", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.Renderer", - "kind": "class" - } - ], - "namespace": "p5.Renderer" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper fxn to measure ascent and descent.\nAdapted from " - }, - { - "type": "link", - "title": null, - "url": "http://stackoverflow.com/a/25355178", - "children": [ - { - "type": "text", - "value": "http://stackoverflow.com/a/25355178" - } - ] - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 520, - "column": 0, - "index": 14977 - }, - "end": { - "line": 523, - "column": 3, - "index": 15081 - } - }, - "context": { - "loc": { - "start": { - "line": 524, - "column": 0, - "index": 15082 - }, - "end": { - "line": 537, - "column": 1, - "index": 15448 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/p5.Renderer.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "object", - "lineNumber": 524 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "calculateOffset", - "kind": "function", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "calculateOffset", - "kind": "function" - } - ], - "namespace": "calculateOffset" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Foundation" - }, - { - "title": "submodule", - "description": "Foundation", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 5, - "column": 3, - "index": 65 - } - }, - "context": { - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 544, - "column": 0, - "index": 18190 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/reference.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Foundation", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Foundation", - "kind": "module" - } - ], - "namespace": "Foundation" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates and names a new variable. A variable is a container for a value." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Variables that are declared with " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "let" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " will have block-scope.\nThis means that the variable only exists within the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nblock" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " that it is created within." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "From " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "the MDN entry" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ":\nDeclares a block scope local variable, optionally initializing it to a value." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 11, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "let" - }, - { - "title": "example", - "description": "
\n\nlet x = 2;\nconsole.log(x); // prints 2 to the console\nx = 1;\nconsole.log(x); // prints 1 to the console\n\n
", - "lineNumber": 13 - }, - { - "title": "alt", - "description": "This example does not render anything", - "lineNumber": 23 - } - ], - "loc": { - "start": { - "line": 7, - "column": 0, - "index": 67 - }, - "end": { - "line": 32, - "column": 3, - "index": 893 - } - }, - "context": { - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 544, - "column": 0, - "index": 18190 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/reference.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nlet x = 2;\nconsole.log(x); // prints 2 to the console\nx = 1;\nconsole.log(x); // prints 1 to the console\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [], - "namespace": "" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates and names a new constant. Like a variable created with " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "let" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\na constant that is created with " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "const" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "inlineCode", - "value": "let" - }, - { - "type": "text", - "value": ", you cannot declare variables without value\nusing const." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Constants have block-scope. This means that the constant only exists within\nthe " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nblock" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " that it is created within. A constant cannot be redeclared within a scope in which it\nalready exists." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "From " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "the MDN entry" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ":\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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 19, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "const" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 21 - }, - { - "title": "alt", - "description": "These examples do not render anything", - "lineNumber": 49 - } - ], - "loc": { - "start": { - "line": 34, - "column": 0, - "index": 895 - }, - "end": { - "line": 85, - "column": 3, - "index": 2917 - } - }, - "context": { - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 544, - "column": 0, - "index": 18190 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/reference.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [], - "namespace": "" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The strict equality operator " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "===" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nchecks to see if two values are equal and of the same type." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A comparison expression always evaluates to a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "boolean" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "From " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "the MDN entry" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ":\nThe non-identity operator returns true if the operands are not equal and/or not of the same type." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: In some examples around the web you may see a double-equals-sign\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "==" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\nused for comparison instead. This is the non-strict equality operator in Javascript.\nThis will convert the two values being compared to the same type before comparing them." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": "===", - "lineNumber": 14, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "null" - }, - { - "title": "example", - "description": "
\n\nconsole.log(1 === 1); // prints true to the console\nconsole.log(1 === '1'); // prints false to the console\n\n
", - "lineNumber": 16 - }, - { - "title": "alt", - "description": "This example does not render anything", - "lineNumber": 24 - } - ], - "loc": { - "start": { - "line": 87, - "column": 0, - "index": 2919 - }, - "end": { - "line": 113, - "column": 3, - "index": 4014 - } - }, - "context": { - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 544, - "column": 0, - "index": 18190 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/reference.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nconsole.log(1 === 1); // prints true to the console\nconsole.log(1 === '1'); // prints false to the console\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [], - "namespace": "" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The greater than operator " - }, - { - "type": "html", - "value": "\">" - }, - { - "type": "text", - "value": ">" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nevaluates to true if the left value is greater than\nthe right value." - } - ] - }, - { - "type": "html", - "value": "\nThere is more info on comparison operators on MDN." - } - ] - }, - "tags": [ - { - "title": "property", - "description": ">", - "lineNumber": 8, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "null" - }, - { - "title": "example", - "description": "
\n\nconsole.log(100 > 1); // prints true to the console\nconsole.log(1 > 100); // prints false to the console\n\n
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything", - "lineNumber": 18 - } - ], - "loc": { - "start": { - "line": 115, - "column": 0, - "index": 4016 - }, - "end": { - "line": 135, - "column": 3, - "index": 4575 - } - }, - "context": { - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 544, - "column": 0, - "index": 18190 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/reference.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nconsole.log(100 > 1); // prints true to the console\nconsole.log(1 > 100); // prints false to the console\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [], - "namespace": "" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The greater than or equal to operator " - }, - { - "type": "html", - "value": "=\">" - }, - { - "type": "text", - "value": ">=" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nevaluates to true if the left value is greater than or equal to\nthe right value." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "There is more info on comparison operators on MDN." - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": ">=", - "lineNumber": 7, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "null" - }, - { - "title": "example", - "description": "
\n\nconsole.log(100 >= 100); // prints true to the console\nconsole.log(101 >= 100); // prints true to the console\n\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "This example does not render anything", - "lineNumber": 17 - } - ], - "loc": { - "start": { - "line": 137, - "column": 0, - "index": 4577 - }, - "end": { - "line": 156, - "column": 3, - "index": 5164 - } - }, - "context": { - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 544, - "column": 0, - "index": 18190 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/reference.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nconsole.log(100 >= 100); // prints true to the console\nconsole.log(101 >= 100); // prints true to the console\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [], - "namespace": "" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The less than operator " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "<" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nevaluates to true if the left value is less than\nthe right value." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "There is more info on comparison operators on MDN." - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": "<", - "lineNumber": 7, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "null" - }, - { - "title": "example", - "description": "
\n\nconsole.log(1 < 100); // prints true to the console\nconsole.log(100 < 99); // prints false to the console\n\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "This example does not render anything", - "lineNumber": 17 - } - ], - "loc": { - "start": { - "line": 158, - "column": 0, - "index": 5166 - }, - "end": { - "line": 177, - "column": 3, - "index": 5716 - } - }, - "context": { - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 544, - "column": 0, - "index": 18190 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/reference.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nconsole.log(1 < 100); // prints true to the console\nconsole.log(100 < 99); // prints false to the console\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [], - "namespace": "" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The less than or equal to operator " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "<=" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nevaluates to true if the left value is less than or equal to\nthe right value." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "There is more info on comparison operators on MDN." - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": "<=", - "lineNumber": 7, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "null" - }, - { - "title": "example", - "description": "
\n\nconsole.log(100 <= 100); // prints true to the console\nconsole.log(99 <= 100); // prints true to the console\n\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "This example does not render anything", - "lineNumber": 17 - } - ], - "loc": { - "start": { - "line": 179, - "column": 0, - "index": 5718 - }, - "end": { - "line": 198, - "column": 3, - "index": 6298 - } - }, - "context": { - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 544, - "column": 0, - "index": 18190 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/reference.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nconsole.log(100 <= 100); // prints true to the console\nconsole.log(99 <= 100); // prints true to the console\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [], - "namespace": "" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "if-else" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " statement helps control the flow of your code." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A condition is placed between the parenthesis following 'if',\nwhen that condition evalues to " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "truthy" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\nthe code between the following curly braces is run.\nAlternatively, when the condition evaluates to " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "falsy" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\nthe code between the curly braces of 'else' block is run instead. Writing an\nelse block is optional." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "From " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "the MDN entry" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ":\nThe 'if' statement executes a statement if a specified condition is truthy.\nIf the condition is falsy, another statement can be executed" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 13, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "if-else" - }, - { - "title": "example", - "description": "
\n\nlet a = 4;\nif (a > 0) {\n console.log('positive');\n} else {\n console.log('negative');\n}\n\n
", - "lineNumber": 15 - }, - { - "title": "alt", - "description": "This example does not render anything", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 200, - "column": 0, - "index": 6300 - }, - "end": { - "line": 229, - "column": 3, - "index": 7388 - } - }, - "context": { - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 544, - "column": 0, - "index": 18190 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/reference.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nlet a = 4;\nif (a > 0) {\n console.log('positive');\n} else {\n console.log('negative');\n}\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [], - "namespace": "" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates and names a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "function" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nA " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "function" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is a set of statements that perform a task." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Optionally, functions can have parameters. " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Parameters" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "From " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "the MDN entry" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ":\nDeclares a function with the specified parameters." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 12, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "function" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 14 - }, - { - "title": "alt", - "description": "This example does not render anything", - "lineNumber": 32 - } - ], - "loc": { - "start": { - "line": 231, - "column": 0, - "index": 7390 - }, - "end": { - "line": 265, - "column": 3, - "index": 8552 - } - }, - "context": { - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 544, - "column": 0, - "index": 18190 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/reference.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [], - "namespace": "" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Specifies the value to be returned by a function.\nFor more info checkout " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nthe MDN entry for return" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "return" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - }, - { - "title": "alt", - "description": "This example does not render anything", - "lineNumber": 17 - } - ], - "loc": { - "start": { - "line": 267, - "column": 0, - "index": 8554 - }, - "end": { - "line": 286, - "column": 3, - "index": 9075 - } - }, - "context": { - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 544, - "column": 0, - "index": 18190 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/reference.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [], - "namespace": "" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "boolean" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is one of the 7 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "primitive data types" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " in Javascript.\nA boolean can only be " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": " or " - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "From " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "the MDN entry" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ":\nBoolean represents a logical entity and can have two values: true, and false." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "boolean" - }, - { - "title": "example", - "description": "
\n\nlet myBoolean = false;\nconsole.log(typeof myBoolean); // prints 'boolean' to the console\n\n
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "This example does not render anything", - "lineNumber": 17 - } - ], - "loc": { - "start": { - "line": 288, - "column": 0, - "index": 9077 - }, - "end": { - "line": 307, - "column": 3, - "index": 9772 - } - }, - "context": { - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 544, - "column": 0, - "index": 18190 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/reference.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nlet myBoolean = false;\nconsole.log(typeof myBoolean); // prints 'boolean' to the console\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [], - "namespace": "" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "string" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is one of the 7 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "primitive data types" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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(\")." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "From " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "the MDN entry" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ":\nA string is a sequence of characters used to represent text." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "string" - }, - { - "title": "example", - "description": "
\n\nlet mood = 'chill';\nconsole.log(typeof mood); // prints 'string' to the console\n\n
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything", - "lineNumber": 18 - } - ], - "loc": { - "start": { - "line": 309, - "column": 0, - "index": 9774 - }, - "end": { - "line": 329, - "column": 3, - "index": 10530 - } - }, - "context": { - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 544, - "column": 0, - "index": 18190 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/reference.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nlet mood = 'chill';\nconsole.log(typeof mood); // prints 'string' to the console\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [], - "namespace": "" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "number" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is one of the 7 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "primitive data types" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " in Javascript.\nA number can be a whole number or a decimal number." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "The MDN entry for number" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "number" - }, - { - "title": "example", - "description": "
\n\nlet num = 46.5;\nconsole.log(typeof num); // prints 'number' to the console\n\n
", - "lineNumber": 8 - }, - { - "title": "alt", - "description": "This example does not render anything", - "lineNumber": 16 - } - ], - "loc": { - "start": { - "line": 331, - "column": 0, - "index": 10532 - }, - "end": { - "line": 349, - "column": 3, - "index": 11117 - } - }, - "context": { - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 544, - "column": 0, - "index": 18190 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/reference.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nlet num = 46.5;\nconsole.log(typeof num); // prints 'number' to the console\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [], - "namespace": "" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "From " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "MDN's object basics" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ":\nAn " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "object" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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.)" - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 7, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "object" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "This example does not render anything", - "lineNumber": 24 - } - ], - "loc": { - "start": { - "line": 351, - "column": 0, - "index": 11119 - }, - "end": { - "line": 377, - "column": 3, - "index": 11864 - } - }, - "context": { - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 544, - "column": 0, - "index": 18190 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/reference.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [], - "namespace": "" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates and names a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "class" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " which is a template for\nthe creation of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "objects" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "From " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "the MDN entry" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ":\nThe class declaration creates a new Class with a given name using\nprototype-based inheritance." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 8, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "class" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "This example does not render anything", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 379, - "column": 0, - "index": 11866 - }, - "end": { - "line": 406, - "column": 3, - "index": 12678 - } - }, - "context": { - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 544, - "column": 0, - "index": 18190 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/reference.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [], - "namespace": "" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "for" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " creates a loop that is useful for executing one\nsection of code multiple times." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The code inside of the loop body (in between the curly braces) is executed between the evaluation of the second\nand third expression." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "for" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "From " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "the MDN entry" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ":\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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 25, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "for" - }, - { - "title": "example", - "description": "
\n\nfor (let i = 0; i < 9; i++) {\n console.log(i);\n}\n\n
", - "lineNumber": 27 - }, - { - "title": "alt", - "description": "This example does not render anything", - "lineNumber": 36 - } - ], - "loc": { - "start": { - "line": 408, - "column": 0, - "index": 12680 - }, - "end": { - "line": 446, - "column": 3, - "index": 14500 - } - }, - "context": { - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 544, - "column": 0, - "index": 18190 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/reference.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nfor (let i = 0; i < 9; i++) {\n console.log(i);\n}\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [], - "namespace": "" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "while" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " creates a loop that is useful for executing\none section of code multiple times." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "while" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", so if the condition is initially false\nthe loop body, or statement, will never execute." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "From " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "the MDN entry" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ":\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." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 19, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "while" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 21 - }, - { - "title": "alt", - "description": "This example does not render anything", - "lineNumber": 38 - } - ], - "loc": { - "start": { - "line": 448, - "column": 0, - "index": 14502 - }, - "end": { - "line": 488, - "column": 3, - "index": 15880 - } - }, - "context": { - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 544, - "column": 0, - "index": 18190 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/reference.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [], - "namespace": "" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "From " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "the MDN entry" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ":\nThe JSON.stringify() method converts a JavaScript object or value to a JSON " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "string" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 3, - "name": "stringify" - }, - { - "title": "static", - "description": null, - "lineNumber": 4 - }, - { - "title": "for", - "description": "JSON", - "lineNumber": 5 - }, - { - "title": "param", - "description": ":Javascript object that you would like to convert to JSON", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Object" - }, - "name": "object" - }, - { - "title": "example", - "description": "
\n\nlet myObject = { x: 5, y: 6 };\nlet myObjectAsString = JSON.stringify(myObject);\nconsole.log(myObjectAsString); // prints \"{\"x\":5,\"y\":6}\" to the console\nconsole.log(typeof myObjectAsString); // prints 'string' to the console\n\n
", - "lineNumber": 8 - }, - { - "title": "alt", - "description": "This example does not render anything", - "lineNumber": 18 - } - ], - "loc": { - "start": { - "line": 490, - "column": 0, - "index": 15882 - }, - "end": { - "line": 510, - "column": 3, - "index": 16624 - } - }, - "context": { - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 544, - "column": 0, - "index": 18190 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/reference.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nlet myObject = { x: 5, y: 6 };\nlet myObjectAsString = JSON.stringify(myObject);\nconsole.log(myObjectAsString); // prints \"{\"x\":5,\"y\":6}\" to the console\nconsole.log(typeof myObjectAsString); // prints 'string' to the console\n\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "object", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": ":Javascript object that you would like to convert to JSON" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "stringify", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "stringify", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".stringify" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Prints a message to your browser's web console. When using p5, you can use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "print" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nand " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "console.log" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " interchangeably." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The console is opened differently depending on which browser you are using.\nHere are links on how to open the console in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Firefox" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\n, " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Chrome" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Edge" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\nand " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Safari" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nWith the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "online p5 editor" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " the console\nis embedded directly in the page underneath the code editor." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "From " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "the MDN entry" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ":\nThe Console method log() outputs a message to the web console. The message may\nbe a single " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "string" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " (with optional substitution values),\nor it may be any one or more JavaScript " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "objects" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 15, - "name": "log" - }, - { - "title": "static", - "description": null, - "lineNumber": 16 - }, - { - "title": "for", - "description": "console", - "lineNumber": 17 - }, - { - "title": "param", - "description": ":Message that you would like to print to the console", - "lineNumber": 18, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Expression" - }, - { - "type": "NameExpression", - "name": "Object" - } - ] - }, - "name": "message" - }, - { - "title": "example", - "description": "
\n\nlet myNum = 5;\nconsole.log(myNum); // prints 5 to the console\nconsole.log(myNum + 12); // prints 17 to the console\n\n
", - "lineNumber": 20 - }, - { - "title": "alt", - "description": "This example does not render anything", - "lineNumber": 29 - } - ], - "loc": { - "start": { - "line": 512, - "column": 0, - "index": 16626 - }, - "end": { - "line": 543, - "column": 3, - "index": 18189 - } - }, - "context": { - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 544, - "column": 0, - "index": 18190 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/reference.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nlet myNum = 5;\nconsole.log(myNum); // prints 5 to the console\nconsole.log(myNum + 12); // prints 17 to the console\n\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "message", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": ":Message that you would like to print to the console" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Expression" - }, - { - "type": "NameExpression", - "name": "Object" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "log", - "scope": "static", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "log", - "kind": "function", - "scope": "static" - } - ], - "namespace": ".log" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates the natural logarithm (the base-e logarithm) of a number. This\nfunction expects the " - }, - { - "type": "inlineCode", - "value": "n" - }, - { - "type": "text", - "value": " parameter to be a value greater than 0.0." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "log" - }, - { - "title": "param", - "description": "number greater than 0.", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "n" - }, - { - "title": "return", - "description": "natural logarithm of n.", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 290, - "column": 2, - "index": 7781 - }, - "end": { - "line": 313, - "column": 5, - "index": 8401 - } - }, - "context": { - "loc": { - "start": { - "line": 314, - "column": 2, - "index": 8404 - }, - "end": { - "line": 314, - "column": 20, - "index": 8422 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number greater than 0." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "natural logarithm of n." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "log", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "log", - "kind": "function" - } - ], - "namespace": "log" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a canvas element in the document and sets its dimensions\nin pixels. This method should be called only once at the start of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nCalling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " more than once in a\nsketch will result in very unpredictable behavior. If you want more than\none drawing canvas you could use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createGraphics()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\n(hidden by default but it can be shown)." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Important note: in 2D mode (i.e. when " - }, - { - "type": "inlineCode", - "value": "p5.Renderer" - }, - { - "type": "text", - "value": " is not set) the origin (0,0)\nis positioned at the top left of the screen. In 3D mode (i.e. when " - }, - { - "type": "inlineCode", - "value": "p5.Renderer" - }, - { - "type": "text", - "value": "\nis set to " - }, - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": "), the origin is positioned at the center of the canvas.\nSee " - }, - { - "type": "link", - "title": null, - "url": "https://github.com/processing/p5.js/issues/1545", - "children": [ - { - "type": "text", - "value": "this issue" - } - ] - }, - { - "type": "text", - "value": " for more information." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A WebGL canvas will use a WebGL2 context if it is supported by the browser.\nCheck the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "webglVersion" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " property to check what\nversion is being used, or call " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setAttributes({ version: 1 })" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nto create a WebGL1 context." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The system variables width and height are set by the parameters passed to this\nfunction. If " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is not used, the\nwindow will be given a default size of 100×100 pixels." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Optionally, an existing canvas can be passed using a selector, ie. " - }, - { - "type": "inlineCode", - "value": "document.getElementById('')" - }, - { - "type": "text", - "value": ".\nIf specified, avoid using " - }, - { - "type": "inlineCode", - "value": "setAttributes()" - }, - { - "type": "text", - "value": " afterwards, as this will remove and recreate the existing canvas." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "For more ways to position the canvas, see the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\npositioning the canvas" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " wiki page." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 29, - "name": "createCanvas" - }, - { - "title": "param", - "description": "width of the canvas", - "lineNumber": 30, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "w" - }, - { - "title": "param", - "description": "height of the canvas", - "lineNumber": 31, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "h" - }, - { - "title": "param", - "description": "either P2D or WEBGL", - "lineNumber": 32, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "P2D" - }, - { - "type": "NameExpression", - "name": "WEBGL" - } - ] - } - }, - "name": "renderer" - }, - { - "title": "param", - "description": "existing html canvas element", - "lineNumber": 33, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "HTMLCanvasElement" - } - }, - "name": "canvas" - }, - { - "title": "return", - "description": "pointer to p5.Renderer holding canvas", - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "p5.Renderer" - } - }, - { - "title": "example", - "description": "
\n\nfunction setup() {\n createCanvas(100, 50);\n background(153);\n line(0, 0, width, height);\n}\n\n
", - "lineNumber": 35 - }, - { - "title": "alt", - "description": "Black line extending from top-left of canvas to bottom right.", - "lineNumber": 46 - } - ], - "loc": { - "start": { - "line": 21, - "column": 0, - "index": 568 - }, - "end": { - "line": 69, - "column": 3, - "index": 2808 - } - }, - "context": { - "loc": { - "start": { - "line": 77, - "column": 0, - "index": 2988 - }, - "end": { - "line": 170, - "column": 2, - "index": 5867 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/rendering.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nfunction setup() {\n createCanvas(100, 50);\n background(153);\n line(0, 0, width, height);\n}\n\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "w", - "lineNumber": 30, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "width of the canvas" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "h", - "lineNumber": 31, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "height of the canvas" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "renderer", - "lineNumber": 32, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either P2D or WEBGL" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "P2D" - }, - { - "type": "NameExpression", - "name": "WEBGL" - } - ] - } - } - }, - { - "title": "param", - "name": "canvas", - "lineNumber": 33, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "existing html canvas element" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "HTMLCanvasElement" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pointer to p5.Renderer holding canvas" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Renderer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createCanvas", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createCanvas", - "kind": "function" - } - ], - "namespace": "createCanvas" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "createCanvas" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "w" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "h" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "HTMLCanvasElement" - } - }, - "name": "canvas" - }, - { - "title": "return", - "description": "pointer to p5.Renderer holding canvas", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Renderer" - } - } - ], - "loc": { - "start": { - "line": 70, - "column": 0, - "index": 2809 - }, - "end": { - "line": 76, - "column": 3, - "index": 2987 - } - }, - "context": { - "loc": { - "start": { - "line": 77, - "column": 0, - "index": 2988 - }, - "end": { - "line": 170, - "column": 2, - "index": 5867 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/rendering.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "w", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "h", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "canvas", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "HTMLCanvasElement" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pointer to p5.Renderer holding canvas" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Renderer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createCanvas", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createCanvas", - "kind": "function" - } - ], - "namespace": "createCanvas" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "resizeCanvas" - }, - { - "title": "param", - "description": "width of the canvas", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "w" - }, - { - "title": "param", - "description": "height of the canvas", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "h" - }, - { - "title": "param", - "description": "don't redraw the canvas immediately", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - }, - "name": "noRedraw" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - }, - { - "title": "alt", - "description": "No image displayed.", - "lineNumber": 23 - } - ], - "loc": { - "start": { - "line": 172, - "column": 0, - "index": 5869 - }, - "end": { - "line": 197, - "column": 3, - "index": 6546 - } - }, - "context": { - "loc": { - "start": { - "line": 198, - "column": 0, - "index": 6547 - }, - "end": { - "line": 230, - "column": 2, - "index": 7506 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/rendering.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "w", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "width of the canvas" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "h", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "height of the canvas" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "noRedraw", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "don't redraw the canvas immediately" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "resizeCanvas", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "resizeCanvas", - "kind": "function" - } - ], - "namespace": "resizeCanvas" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes the default canvas for a p5 sketch that doesn't require a canvas" - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 2, - "name": "noCanvas" - }, - { - "title": "example", - "description": "
\n\nfunction setup() {\n noCanvas();\n}\n\n
", - "lineNumber": 3 - }, - { - "title": "alt", - "description": "no image displayed", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 232, - "column": 0, - "index": 7508 - }, - "end": { - "line": 246, - "column": 3, - "index": 7740 - } - }, - "context": { - "loc": { - "start": { - "line": 247, - "column": 0, - "index": 7741 - }, - "end": { - "line": 251, - "column": 2, - "index": 7858 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/rendering.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nfunction setup() {\n noCanvas();\n}\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "noCanvas", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "noCanvas", - "kind": "function" - } - ], - "namespace": "noCanvas" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A WebGL p5.Graphics will use a WebGL2 context if it is supported by the browser.\nCheck the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pg.webglVersion" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " property of the renderer\nto check what version is being used, or call " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pg.setAttributes({ version: 1 })" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nto create a WebGL1 context." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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;" - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 13, - "name": "createGraphics" - }, - { - "title": "param", - "description": "width of the offscreen graphics buffer", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "w" - }, - { - "title": "param", - "description": "height of the offscreen graphics buffer", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "h" - }, - { - "title": "param", - "description": "either P2D or WEBGL\n undefined defaults to p2d", - "lineNumber": 16, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "P2D" - }, - { - "type": "NameExpression", - "name": "WEBGL" - } - ] - } - }, - "name": "renderer" - }, - { - "title": "param", - "description": "existing html canvas element", - "lineNumber": 18, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "HTMLCanvasElement" - } - }, - "name": "canvas" - }, - { - "title": "return", - "description": "offscreen graphics buffer", - "lineNumber": 19, - "type": { - "type": "NameExpression", - "name": "p5.Graphics" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 20 - }, - { - "title": "alt", - "description": "4 grey squares alternating light and dark grey. White quarter circle mid-left.", - "lineNumber": 40 - } - ], - "loc": { - "start": { - "line": 253, - "column": 0, - "index": 7860 - }, - "end": { - "line": 295, - "column": 3, - "index": 9426 - } - }, - "context": { - "loc": { - "start": { - "line": 303, - "column": 0, - "index": 9596 - }, - "end": { - "line": 314, - "column": 2, - "index": 9952 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/rendering.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "w", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "width of the offscreen graphics buffer" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "h", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "height of the offscreen graphics buffer" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "renderer", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either P2D or WEBGL\nundefined defaults to p2d" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "P2D" - }, - { - "type": "NameExpression", - "name": "WEBGL" - } - ] - } - } - }, - { - "title": "param", - "name": "canvas", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "existing html canvas element" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "HTMLCanvasElement" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "offscreen graphics buffer" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Graphics" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createGraphics", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createGraphics", - "kind": "function" - } - ], - "namespace": "createGraphics" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "createGraphics" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "w" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "h" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "HTMLCanvasElement" - } - }, - "name": "canvas" - }, - { - "title": "return", - "description": "offscreen graphics buffer", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Graphics" - } - } - ], - "loc": { - "start": { - "line": 296, - "column": 0, - "index": 9427 - }, - "end": { - "line": 302, - "column": 3, - "index": 9595 - } - }, - "context": { - "loc": { - "start": { - "line": 303, - "column": 0, - "index": 9596 - }, - "end": { - "line": 314, - "column": 2, - "index": 9952 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/rendering.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "w", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "h", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "canvas", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "HTMLCanvasElement" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "offscreen graphics buffer" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Graphics" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createGraphics", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createGraphics", - "kind": "function" - } - ], - "namespace": "createGraphics" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "args[0] is expected to be renderer\nargs[1] is expected to be canvas" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 304, - "column": 0, - "index": 9652 - }, - "end": { - "line": 307, - "column": 4, - "index": 9736 - } - }, - "context": { - "loc": { - "start": { - "line": 308, - "column": 2, - "index": 9739 - }, - "end": { - "line": 311, - "column": 3, - "index": 9838 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/rendering.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "args", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "args" - } - ], - "namespace": "args" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates and returns a new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Framebuffer" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", a\nhigh-performance WebGL object that you can draw to and then use as a texture." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Options can include:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "format" - }, - { - "type": "text", - "value": ": The data format of the texture, either " - }, - { - "type": "inlineCode", - "value": "UNSIGNED_BYTE" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "FLOAT" - }, - { - "type": "text", - "value": ", or " - }, - { - "type": "inlineCode", - "value": "HALF_FLOAT" - }, - { - "type": "text", - "value": ". The default is " - }, - { - "type": "inlineCode", - "value": "UNSIGNED_BYTE" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "channels" - }, - { - "type": "text", - "value": ": What color channels to store, either " - }, - { - "type": "inlineCode", - "value": "RGB" - }, - { - "type": "text", - "value": " or " - }, - { - "type": "inlineCode", - "value": "RGBA" - }, - { - "type": "text", - "value": ". The default is to match the channels in the main canvas (with alpha unless disabled with " - }, - { - "type": "inlineCode", - "value": "setAttributes" - }, - { - "type": "text", - "value": ".)" - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "depth" - }, - { - "type": "text", - "value": ": A boolean, whether or not to include a depth buffer. Defaults to true." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "depthFormat" - }, - { - "type": "text", - "value": ": The data format for depth information, either " - }, - { - "type": "inlineCode", - "value": "UNSIGNED_INT" - }, - { - "type": "text", - "value": " or " - }, - { - "type": "inlineCode", - "value": "FLOAT" - }, - { - "type": "text", - "value": ". The default is " - }, - { - "type": "inlineCode", - "value": "FLOAT" - }, - { - "type": "text", - "value": " if available, or " - }, - { - "type": "inlineCode", - "value": "UNSIGNED_INT" - }, - { - "type": "text", - "value": " otherwise." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "stencil" - }, - { - "type": "text", - "value": ": 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 " - }, - { - "type": "inlineCode", - "value": "depth" - }, - { - "type": "text", - "value": ", which is true if not provided." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "antialias" - }, - { - "type": "text", - "value": ": 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." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "width" - }, - { - "type": "text", - "value": ": The width of the texture. Defaults to matching the main canvas." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "height" - }, - { - "type": "text", - "value": ": The height of the texture. Defaults to matching the main canvas." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "density" - }, - { - "type": "text", - "value": ": The pixel density of the texture. Defaults to the pixel density of the main canvas." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "textureFiltering" - }, - { - "type": "text", - "value": ": Either " - }, - { - "type": "inlineCode", - "value": "LINEAR" - }, - { - "type": "text", - "value": " (nearby pixels will be interpolated when reading values from the color texture) or " - }, - { - "type": "inlineCode", - "value": "NEAREST" - }, - { - "type": "text", - "value": " (no interpolation.) Generally, use " - }, - { - "type": "inlineCode", - "value": "LINEAR" - }, - { - "type": "text", - "value": " when using the texture as an image, and use " - }, - { - "type": "inlineCode", - "value": "NEAREST" - }, - { - "type": "text", - "value": " if reading the texture as data. Defaults to " - }, - { - "type": "inlineCode", - "value": "LINEAR" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If " - }, - { - "type": "inlineCode", - "value": "width" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "height" - }, - { - "type": "text", - "value": ", or " - }, - { - "type": "inlineCode", - "value": "density" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 21, - "name": "createFramebuffer" - }, - { - "title": "param", - "description": "An optional object with configuration", - "lineNumber": 22, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - }, - "name": "options" - }, - { - "title": "return", - "description": null, - "lineNumber": 23, - "type": { - "type": "NameExpression", - "name": "p5.Framebuffer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 25 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 67 - } - ], - "loc": { - "start": { - "line": 316, - "column": 0, - "index": 9954 - }, - "end": { - "line": 386, - "column": 3, - "index": 13274 - } - }, - "context": { - "loc": { - "start": { - "line": 387, - "column": 0, - "index": 13275 - }, - "end": { - "line": 389, - "column": 2, - "index": 13374 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/rendering.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "options", - "lineNumber": 22, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An optional object with configuration" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Framebuffer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createFramebuffer", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createFramebuffer", - "kind": "function" - } - ], - "namespace": "createFramebuffer" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 13, - "name": "clearDepth" - }, - { - "title": "param", - "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.", - "lineNumber": 14, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "depth" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 19 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 61 - } - ], - "loc": { - "start": { - "line": 391, - "column": 0, - "index": 13376 - }, - "end": { - "line": 455, - "column": 3, - "index": 15403 - } - }, - "context": { - "loc": { - "start": { - "line": 456, - "column": 0, - "index": 15404 - }, - "end": { - "line": 459, - "column": 2, - "index": 15518 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/rendering.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "depth", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "clearDepth", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "clearDepth", - "kind": "function" - } - ], - "namespace": "clearDepth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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):" - } - ] - }, - { - "type": "html", - "value": "
    \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
" - }, - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "(2D)" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " indicates that this blend mode " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "only" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " works in the 2D renderer." - }, - { - "type": "html", - "value": "
" - }, - { - "type": "text", - "value": "\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "(3D)" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " indicates that this blend mode " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "only" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " works in the WEBGL renderer." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 40, - "name": "blendMode" - }, - { - "title": "param", - "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", - "lineNumber": 41, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "BLEND" - }, - { - "type": "NameExpression", - "name": "DARKEST" - }, - { - "type": "NameExpression", - "name": "LIGHTEST" - }, - { - "type": "NameExpression", - "name": "DIFFERENCE" - }, - { - "type": "NameExpression", - "name": "MULTIPLY" - }, - { - "type": "NameExpression", - "name": "EXCLUSION" - }, - { - "type": "NameExpression", - "name": "SCREEN" - }, - { - "type": "NameExpression", - "name": "REPLACE" - }, - { - "type": "NameExpression", - "name": "OVERLAY" - }, - { - "type": "NameExpression", - "name": "HARD_LIGHT" - }, - { - "type": "NameExpression", - "name": "SOFT_LIGHT" - }, - { - "type": "NameExpression", - "name": "DODGE" - }, - { - "type": "NameExpression", - "name": "BURN" - }, - { - "type": "NameExpression", - "name": "ADD" - }, - { - "type": "NameExpression", - "name": "REMOVE" - }, - { - "type": "NameExpression", - "name": "SUBTRACT" - } - ] - }, - "name": "mode" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 45 - }, - { - "title": "alt", - "description": "translucent image thick red & blue diagonal rounded lines intersecting center\nThick red & blue diagonal rounded lines intersecting center. dark at overlap", - "lineNumber": 68 - } - ], - "loc": { - "start": { - "line": 461, - "column": 0, - "index": 15520 - }, - "end": { - "line": 532, - "column": 3, - "index": 18598 - } - }, - "context": { - "loc": { - "start": { - "line": 533, - "column": 0, - "index": 18599 - }, - "end": { - "line": 543, - "column": 2, - "index": 18975 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/rendering.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "mode", - "lineNumber": 41, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "BLEND" - }, - { - "type": "NameExpression", - "name": "DARKEST" - }, - { - "type": "NameExpression", - "name": "LIGHTEST" - }, - { - "type": "NameExpression", - "name": "DIFFERENCE" - }, - { - "type": "NameExpression", - "name": "MULTIPLY" - }, - { - "type": "NameExpression", - "name": "EXCLUSION" - }, - { - "type": "NameExpression", - "name": "SCREEN" - }, - { - "type": "NameExpression", - "name": "REPLACE" - }, - { - "type": "NameExpression", - "name": "OVERLAY" - }, - { - "type": "NameExpression", - "name": "HARD_LIGHT" - }, - { - "type": "NameExpression", - "name": "SOFT_LIGHT" - }, - { - "type": "NameExpression", - "name": "DODGE" - }, - { - "type": "NameExpression", - "name": "BURN" - }, - { - "type": "NameExpression", - "name": "ADD" - }, - { - "type": "NameExpression", - "name": "REMOVE" - }, - { - "type": "NameExpression", - "name": "SUBTRACT" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "blendMode", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "blendMode", - "kind": "function" - } - ], - "namespace": "blendMode" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "inlineCode", - "value": "drawingContext" - }, - { - "type": "text", - "value": ", as in the example shown. This is\nthe equivalent of calling " - }, - { - "type": "inlineCode", - "value": "canvas.getContext('2d');" - }, - { - "type": "text", - "value": " or " - }, - { - "type": "inlineCode", - "value": "canvas.getContext('webgl');" - }, - { - "type": "text", - "value": ".\nSee this\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nreference for the native canvas API" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for possible drawing functions you can call." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 9, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "drawingContext" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "white ellipse with shadow blur effect around edges", - "lineNumber": 24 - } - ], - "loc": { - "start": { - "line": 545, - "column": 0, - "index": 18977 - }, - "end": { - "line": 571, - "column": 3, - "index": 19921 - } - }, - "context": { - "loc": { - "start": { - "line": 573, - "column": 0, - "index": 19923 - }, - "end": { - "line": 573, - "column": 18, - "index": 19941 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/rendering.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "rendering", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "rendering" - } - ], - "namespace": "rendering" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Shape" - }, - { - "title": "submodule", - "description": "2D Primitives", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - }, - { - "title": "requires", - "description": null, - "lineNumber": 5, - "name": "constants" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 7, - "column": 3, - "index": 104 - } - }, - "context": { - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 106 - }, - "end": { - "line": 9, - "column": 25, - "index": 131 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Shape", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Shape", - "kind": "module" - } - ], - "namespace": "Shape" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Shape" - }, - { - "title": "submodule", - "description": "Attributes", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - }, - { - "title": "requires", - "description": null, - "lineNumber": 5, - "name": "constants" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 7, - "column": 3, - "index": 101 - } - }, - "context": { - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 103 - }, - "end": { - "line": 9, - "column": 25, - "index": 128 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/attributes.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Shape", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Shape", - "kind": "module" - } - ], - "namespace": "Shape" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Shape" - }, - { - "title": "submodule", - "description": "Curves", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 74 - } - }, - "context": { - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 76 - }, - "end": { - "line": 8, - "column": 25, - "index": 101 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/curves.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Shape", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Shape", - "kind": "module" - } - ], - "namespace": "Shape" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Shape" - }, - { - "title": "submodule", - "description": "Vertex", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - }, - { - "title": "requires", - "description": null, - "lineNumber": 5, - "name": "constants" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 7, - "column": 3, - "index": 97 - } - }, - "context": { - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 99 - }, - "end": { - "line": 9, - "column": 25, - "index": 124 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/vertex.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Shape", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Shape", - "kind": "module" - } - ], - "namespace": "Shape" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Shape" - }, - { - "title": "submodule", - "description": "3D Primitives", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - }, - { - "title": "requires", - "description": null, - "lineNumber": 5, - "name": "p5.Geometry" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 7, - "column": 3, - "index": 106 - } - }, - "context": { - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 108 - }, - "end": { - "line": 9, - "column": 30, - "index": 138 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/3d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Shape", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Shape", - "kind": "module" - } - ], - "namespace": "Shape" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Shape" - }, - { - "title": "submodule", - "description": "3D Models", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - }, - { - "title": "requires", - "description": null, - "lineNumber": 5, - "name": "p5.Geometry" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 7, - "column": 3, - "index": 102 - } - }, - "context": { - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 104 - }, - "end": { - "line": 9, - "column": 30, - "index": 134 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/loading.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Shape", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Shape", - "kind": "module" - } - ], - "namespace": "Shape" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Shape" - }, - { - "title": "submodule", - "description": "3D Primitives", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - }, - { - "title": "requires", - "description": null, - "lineNumber": 5, - "name": "p5.Geometry" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 7, - "column": 3, - "index": 106 - } - }, - "context": { - "loc": { - "start": { - "line": 11, - "column": 0, - "index": 180 - }, - "end": { - "line": 11, - "column": 30, - "index": 210 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Geometry.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Shape", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Shape", - "kind": "module" - } - ], - "namespace": "Shape" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Draws an arc to the canvas. Arcs are drawn along the outer edge of an ellipse\n(oval) defined by the " - }, - { - "type": "inlineCode", - "value": "x" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "y" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "w" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "h" - }, - { - "type": "text", - "value": " parameters. Use the " - }, - { - "type": "inlineCode", - "value": "start" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "stop" - }, - { - "type": "text", - "value": "\nparameters to specify the angles (in radians) at which to draw the arc. Arcs are\nalways drawn clockwise from " - }, - { - "type": "inlineCode", - "value": "start" - }, - { - "type": "text", - "value": " to " - }, - { - "type": "inlineCode", - "value": "stop" - }, - { - "type": "text", - "value": ". The origin of the arc's ellipse may\nbe changed with the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "ellipseMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The optional " - }, - { - "type": "inlineCode", - "value": "mode" - }, - { - "type": "text", - "value": " parameter determines the arc's fill style. The fill modes are\na semi-circle (" - }, - { - "type": "inlineCode", - "value": "OPEN" - }, - { - "type": "text", - "value": "), a closed semi-circle (" - }, - { - "type": "inlineCode", - "value": "CHORD" - }, - { - "type": "text", - "value": "), or a closed pie segment (" - }, - { - "type": "inlineCode", - "value": "PIE" - }, - { - "type": "text", - "value": ")." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 10, - "name": "arc" - }, - { - "title": "param", - "description": "x-coordinate of the arc's ellipse.", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y-coordinate of the arc's ellipse.", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "width of the arc's ellipse by default.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "w" - }, - { - "title": "param", - "description": "height of the arc's ellipse by default.", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "h" - }, - { - "title": "param", - "description": "angle to start the arc, specified in radians.", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "start" - }, - { - "title": "param", - "description": "angle to stop the arc, specified in radians.", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "stop" - }, - { - "title": "param", - "description": "optional parameter to determine the way of drawing\n the arc. either CHORD, PIE, or OPEN.", - "lineNumber": 17, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "CHORD" - }, - { - "type": "NameExpression", - "name": "PIE" - }, - { - "type": "NameExpression", - "name": "OPEN" - } - ] - } - }, - "name": "mode" - }, - { - "title": "param", - "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.", - "lineNumber": 19, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detail" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 23 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 102, - "column": 0, - "index": 3625 - }, - "end": { - "line": 171, - "column": 3, - "index": 6225 - } - }, - "context": { - "loc": { - "start": { - "line": 172, - "column": 0, - "index": 6226 - }, - "end": { - "line": 229, - "column": 2, - "index": 7850 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the arc's ellipse." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the arc's ellipse." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "w", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "width of the arc's ellipse by default." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "h", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "height of the arc's ellipse by default." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "start", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "angle to start the arc, specified in radians." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "stop", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "angle to stop the arc, specified in radians." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "mode", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional parameter to determine the way of drawing\nthe arc. either CHORD, PIE, or OPEN." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "CHORD" - }, - { - "type": "NameExpression", - "name": "PIE" - }, - { - "type": "NameExpression", - "name": "OPEN" - } - ] - } - } - }, - { - "title": "param", - "name": "detail", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "arc", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "arc", - "kind": "function" - } - ], - "namespace": "arc" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "ellipseMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 11, - "name": "ellipse" - }, - { - "title": "param", - "description": "x-coordinate of the center of the ellipse.", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y-coordinate of the center of the ellipse.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "width of the ellipse.", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "w" - }, - { - "title": "param", - "description": "height of the ellipse.", - "lineNumber": 15, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "h" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 16 - }, - { - "title": "example", - "description": "
\n\nellipse(56, 46, 55, 55);\ndescribe('A white ellipse with black outline in middle of a gray canvas.');\n\n
", - "lineNumber": 17 - } - ], - "loc": { - "start": { - "line": 231, - "column": 0, - "index": 7852 - }, - "end": { - "line": 256, - "column": 3, - "index": 8808 - } - }, - "context": { - "loc": { - "start": { - "line": 269, - "column": 0, - "index": 9233 - }, - "end": { - "line": 272, - "column": 2, - "index": 9382 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nellipse(56, 46, 55, 55);\ndescribe('A white ellipse with black outline in middle of a gray canvas.');\n\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the center of the ellipse." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the center of the ellipse." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "w", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "width of the ellipse." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "h", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "height of the ellipse." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "ellipse", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ellipse", - "kind": "function" - } - ], - "namespace": "ellipse" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "ellipse" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "w" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "h" - }, - { - "title": "param", - "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.", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detail" - } - ], - "loc": { - "start": { - "line": 258, - "column": 0, - "index": 8810 - }, - "end": { - "line": 268, - "column": 3, - "index": 9232 - } - }, - "context": { - "loc": { - "start": { - "line": 269, - "column": 0, - "index": 9233 - }, - "end": { - "line": 272, - "column": 2, - "index": 9382 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "w", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "h", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "detail", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "ellipse", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ellipse", - "kind": "function" - } - ], - "namespace": "ellipse" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "ellipseMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 7, - "name": "circle" - }, - { - "title": "param", - "description": "x-coordinate of the center of the circle.", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y-coordinate of the center of the circle.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "diameter of the circle.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "d" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\n\ncircle(30, 30, 20);\ndescribe('A white circle with black outline in the middle of a gray canvas.');\n\n
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 274, - "column": 0, - "index": 9384 - }, - "end": { - "line": 294, - "column": 3, - "index": 10148 - } - }, - "context": { - "loc": { - "start": { - "line": 295, - "column": 0, - "index": 10149 - }, - "end": { - "line": 301, - "column": 2, - "index": 10386 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\ncircle(30, 30, 20);\ndescribe('A white circle with black outline in the middle of a gray canvas.');\n\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the center of the circle." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the center of the circle." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "d", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "diameter of the circle." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "circle", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "circle", - "kind": "function" - } - ], - "namespace": "circle" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Draws a line, a straight path between two points. Its default width is one pixel.\nThe version of " - }, - { - "type": "inlineCode", - "value": "line()" - }, - { - "type": "text", - "value": " with four parameters draws the line in 2D. To color a line,\nuse the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "stroke()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function. To change its width, use the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "strokeWeight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function. A line\ncan't be filled, so the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "fill()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function won't affect\nthe color of a line." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "line()" - }, - { - "type": "text", - "value": " with six parameters allows the line to be drawn in 3D\nspace. Doing so requires adding the " - }, - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " argument to\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 12, - "name": "line" - }, - { - "title": "param", - "description": "the x-coordinate of the first point.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x1" - }, - { - "title": "param", - "description": "the y-coordinate of the first point.", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y1" - }, - { - "title": "param", - "description": "the x-coordinate of the second point.", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x2" - }, - { - "title": "param", - "description": "the y-coordinate of the second point.", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y2" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 17 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 18 - } - ], - "loc": { - "start": { - "line": 334, - "column": 0, - "index": 11274 - }, - "end": { - "line": 389, - "column": 3, - "index": 12880 - } - }, - "context": { - "loc": { - "start": { - "line": 401, - "column": 0, - "index": 13133 - }, - "end": { - "line": 414, - "column": 2, - "index": 13438 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x1", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the x-coordinate of the first point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y1", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the y-coordinate of the first point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x2", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the x-coordinate of the second point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y2", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the y-coordinate of the second point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "line", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "line", - "kind": "function" - } - ], - "namespace": "line" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "line" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x1" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y1" - }, - { - "title": "param", - "description": "the z-coordinate of the first point.", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z1" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x2" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y2" - }, - { - "title": "param", - "description": "the z-coordinate of the second point.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z2" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 391, - "column": 0, - "index": 12882 - }, - "end": { - "line": 400, - "column": 3, - "index": 13132 - } - }, - "context": { - "loc": { - "start": { - "line": 401, - "column": 0, - "index": 13133 - }, - "end": { - "line": 414, - "column": 2, - "index": 13438 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x1", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y1", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z1", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the z-coordinate of the first point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x2", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y2", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z2", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the z-coordinate of the second point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "line", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "line", - "kind": "function" - } - ], - "namespace": "line" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "stroke()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function. To change its size, use the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "strokeWeight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "point()" - }, - { - "type": "text", - "value": " with three parameters allows the point to be drawn in 3D\nspace. Doing so requires adding the " - }, - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " argument to\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of point() with one parameter allows the point's location to be set with\na " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 13, - "name": "point" - }, - { - "title": "param", - "description": "the x-coordinate.", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "the y-coordinate.", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "the z-coordinate (for WebGL mode).", - "lineNumber": 16, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "z" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 17 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 18 - } - ], - "loc": { - "start": { - "line": 416, - "column": 0, - "index": 13440 - }, - "end": { - "line": 477, - "column": 3, - "index": 15162 - } - }, - "context": { - "loc": { - "start": { - "line": 484, - "column": 0, - "index": 15265 - }, - "end": { - "line": 505, - "column": 2, - "index": 15793 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the x-coordinate." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the y-coordinate." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the z-coordinate (for WebGL mode)." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "point", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "point", - "kind": "function" - } - ], - "namespace": "point" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "point" - }, - { - "title": "param", - "description": "the coordinate vector.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "coordinateVector" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 479, - "column": 0, - "index": 15164 - }, - "end": { - "line": 483, - "column": 3, - "index": 15264 - } - }, - "context": { - "loc": { - "start": { - "line": 484, - "column": 0, - "index": 15265 - }, - "end": { - "line": 505, - "column": 2, - "index": 15793 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "coordinateVector", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the coordinate vector." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "point", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "point", - "kind": "function" - } - ], - "namespace": "point" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 (" - }, - { - "type": "inlineCode", - "value": "x1" - }, - { - "type": "text", - "value": "," - }, - { - "type": "inlineCode", - "value": "y1" - }, - { - "type": "text", - "value": ") 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "quad()" - }, - { - "type": "text", - "value": " with twelve parameters allows the quad to be drawn\nin 3D space. Doing so requires adding the " - }, - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " argument to\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 12, - "name": "quad" - }, - { - "title": "param", - "description": "the x-coordinate of the first point.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x1" - }, - { - "title": "param", - "description": "the y-coordinate of the first point.", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y1" - }, - { - "title": "param", - "description": "the x-coordinate of the second point.", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x2" - }, - { - "title": "param", - "description": "the y-coordinate of the second point.", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y2" - }, - { - "title": "param", - "description": "the x-coordinate of the third point.", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x3" - }, - { - "title": "param", - "description": "the y-coordinate of the third point.", - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y3" - }, - { - "title": "param", - "description": "the x-coordinate of the fourth point.", - "lineNumber": 19, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x4" - }, - { - "title": "param", - "description": "the y-coordinate of the fourth point.", - "lineNumber": 20, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y4" - }, - { - "title": "param", - "description": "number of segments in the x-direction.", - "lineNumber": 21, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailX" - }, - { - "title": "param", - "description": "number of segments in the y-direction.", - "lineNumber": 22, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailY" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 23 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 24 - } - ], - "loc": { - "start": { - "line": 507, - "column": 0, - "index": 15795 - }, - "end": { - "line": 559, - "column": 3, - "index": 17702 - } - }, - "context": { - "loc": { - "start": { - "line": 578, - "column": 0, - "index": 18215 - }, - "end": { - "line": 601, - "column": 2, - "index": 18903 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x1", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the x-coordinate of the first point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y1", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the y-coordinate of the first point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x2", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the x-coordinate of the second point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y2", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the y-coordinate of the second point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x3", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the x-coordinate of the third point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y3", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the y-coordinate of the third point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x4", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the x-coordinate of the fourth point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y4", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the y-coordinate of the fourth point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "detailX", - "lineNumber": 21, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of segments in the x-direction." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - }, - { - "title": "param", - "name": "detailY", - "lineNumber": 22, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of segments in the y-direction." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "quad", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "quad", - "kind": "function" - } - ], - "namespace": "quad" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "quad" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x1" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y1" - }, - { - "title": "param", - "description": "the z-coordinate of the first point.", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z1" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x2" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y2" - }, - { - "title": "param", - "description": "the z-coordinate of the second point.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z2" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x3" - }, - { - "title": "param", - "description": null, - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y3" - }, - { - "title": "param", - "description": "the z-coordinate of the third point.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z3" - }, - { - "title": "param", - "description": null, - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x4" - }, - { - "title": "param", - "description": null, - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y4" - }, - { - "title": "param", - "description": "the z-coordinate of the fourth point.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z4" - }, - { - "title": "param", - "description": null, - "lineNumber": 14, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailX" - }, - { - "title": "param", - "description": null, - "lineNumber": 15, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailY" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 16 - } - ], - "loc": { - "start": { - "line": 560, - "column": 0, - "index": 17703 - }, - "end": { - "line": 577, - "column": 3, - "index": 18214 - } - }, - "context": { - "loc": { - "start": { - "line": 578, - "column": 0, - "index": 18215 - }, - "end": { - "line": 601, - "column": 2, - "index": 18903 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x1", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y1", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z1", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the z-coordinate of the first point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x2", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y2", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z2", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the z-coordinate of the second point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x3", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y3", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z3", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the z-coordinate of the third point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x4", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y4", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z4", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the z-coordinate of the fourth point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "detailX", - "lineNumber": 14, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - }, - { - "title": "param", - "name": "detailY", - "lineNumber": 15, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "quad", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "quad", - "kind": "function" - } - ], - "namespace": "quad" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "rectMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfunction." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "rect()" - }, - { - "type": "text", - "value": " with five parameters creates a rounded rectangle. The\nfifth parameter is used as the radius value for all four corners." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "rect()" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 17, - "name": "rect" - }, - { - "title": "param", - "description": "x-coordinate of the rectangle.", - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y-coordinate of the rectangle.", - "lineNumber": 19, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "width of the rectangle.", - "lineNumber": 20, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "w" - }, - { - "title": "param", - "description": "height of the rectangle.", - "lineNumber": 21, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "h" - }, - { - "title": "param", - "description": "optional radius of top-left corner.", - "lineNumber": 22, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "tl" - }, - { - "title": "param", - "description": "optional radius of top-right corner.", - "lineNumber": 23, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "tr" - }, - { - "title": "param", - "description": "optional radius of bottom-right corner.", - "lineNumber": 24, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "br" - }, - { - "title": "param", - "description": "optional radius of bottom-left corner.", - "lineNumber": 25, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "bl" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 26 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 603, - "column": 0, - "index": 18905 - }, - "end": { - "line": 654, - "column": 3, - "index": 20836 - } - }, - "context": { - "loc": { - "start": { - "line": 666, - "column": 0, - "index": 21138 - }, - "end": { - "line": 669, - "column": 2, - "index": 21256 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the rectangle." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the rectangle." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "w", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "width of the rectangle." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "h", - "lineNumber": 21, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "height of the rectangle." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "tl", - "lineNumber": 22, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional radius of top-left corner." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "tr", - "lineNumber": 23, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional radius of top-right corner." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "br", - "lineNumber": 24, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional radius of bottom-right corner." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "bl", - "lineNumber": 25, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional radius of bottom-left corner." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "rect", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "rect", - "kind": "function" - } - ], - "namespace": "rect" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "rect" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "w" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "h" - }, - { - "title": "param", - "description": "number of segments in the x-direction (for WebGL mode).", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailX" - }, - { - "title": "param", - "description": "number of segments in the y-direction (for WebGL mode).", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailY" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 656, - "column": 0, - "index": 20838 - }, - "end": { - "line": 665, - "column": 3, - "index": 21137 - } - }, - "context": { - "loc": { - "start": { - "line": 666, - "column": 0, - "index": 21138 - }, - "end": { - "line": 669, - "column": 2, - "index": 21256 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "w", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "h", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "detailX", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of segments in the x-direction (for WebGL mode)." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - }, - { - "title": "param", - "name": "detailY", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of segments in the y-direction (for WebGL mode)." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "rect", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "rect", - "kind": "function" - } - ], - "namespace": "rect" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "rectMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "square()" - }, - { - "type": "text", - "value": " with four parameters creates a rounded square. The\nfourth parameter is used as the radius value for all four corners." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "square()" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 16, - "name": "square" - }, - { - "title": "param", - "description": "x-coordinate of the square.", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y-coordinate of the square.", - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "side size of the square.", - "lineNumber": 19, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "s" - }, - { - "title": "param", - "description": "optional radius of top-left corner.", - "lineNumber": 20, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "tl" - }, - { - "title": "param", - "description": "optional radius of top-right corner.", - "lineNumber": 21, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "tr" - }, - { - "title": "param", - "description": "optional radius of bottom-right corner.", - "lineNumber": 22, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "br" - }, - { - "title": "param", - "description": "optional radius of bottom-left corner.", - "lineNumber": 23, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "bl" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 24 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 671, - "column": 0, - "index": 21258 - }, - "end": { - "line": 720, - "column": 3, - "index": 23098 - } - }, - "context": { - "loc": { - "start": { - "line": 721, - "column": 0, - "index": 23099 - }, - "end": { - "line": 725, - "column": 2, - "index": 23322 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the square." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the square." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "s", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "side size of the square." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "tl", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional radius of top-left corner." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "tr", - "lineNumber": 21, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional radius of top-right corner." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "br", - "lineNumber": 22, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional radius of bottom-right corner." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "bl", - "lineNumber": 23, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional radius of bottom-left corner." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "square", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "square", - "kind": "function" - } - ], - "namespace": "square" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Draws a triangle to the canvas. A triangle is a three-sided polygon. The\nfirst two parameters specify the triangle's first point " - }, - { - "type": "inlineCode", - "value": "(x1,y1)" - }, - { - "type": "text", - "value": ". The middle\ntwo parameters specify its second point " - }, - { - "type": "inlineCode", - "value": "(x2,y2)" - }, - { - "type": "text", - "value": ". And the last two parameters\nspecify its third point " - }, - { - "type": "inlineCode", - "value": "(x3, y3)" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "triangle" - }, - { - "title": "param", - "description": "x-coordinate of the first point.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x1" - }, - { - "title": "param", - "description": "y-coordinate of the first point.", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y1" - }, - { - "title": "param", - "description": "x-coordinate of the second point.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x2" - }, - { - "title": "param", - "description": "y-coordinate of the second point.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y2" - }, - { - "title": "param", - "description": "x-coordinate of the third point.", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x3" - }, - { - "title": "param", - "description": "y-coordinate of the third point.", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y3" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 13 - }, - { - "title": "example", - "description": "
\n\ntriangle(30, 75, 58, 20, 86, 75);\ndescribe('A white triangle with a black outline on a gray canvas.');\n\n
", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 759, - "column": 0, - "index": 24254 - }, - "end": { - "line": 781, - "column": 3, - "index": 25078 - } - }, - "context": { - "loc": { - "start": { - "line": 782, - "column": 0, - "index": 25079 - }, - "end": { - "line": 795, - "column": 2, - "index": 25423 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/2d_primitives.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\ntriangle(30, 75, 58, 20, 86, 75);\ndescribe('A white triangle with a black outline on a gray canvas.');\n\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x1", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the first point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y1", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the first point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x2", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the second point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y2", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the second point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x3", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the third point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y3", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the third point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "triangle", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "triangle", - "kind": "function" - } - ], - "namespace": "triangle" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "inlineCode", - "value": "ellipseMode(CENTER)" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "ellipseMode(RADIUS)" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "inlineCode", - "value": "ellipse(0, 0, 10, 15)" - }, - { - "type": "text", - "value": " draws a shape with a width of 20 and height of 30." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "ellipseMode(CORNER)" - }, - { - "type": "text", - "value": " uses the first two parameters as the upper-left corner of the\nshape. The next parameters are its width and height." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "ellipseMode(CORNERS)" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The argument passed to " - }, - { - "type": "inlineCode", - "value": "ellipseMode()" - }, - { - "type": "text", - "value": " must be written in ALL CAPS because the constants\n" - }, - { - "type": "inlineCode", - "value": "CENTER" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "RADIUS" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "CORNER" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "CORNERS" - }, - { - "type": "text", - "value": " are defined this way. JavaScript is a\ncase-sensitive language." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 20, - "name": "ellipseMode" - }, - { - "title": "param", - "description": "either CENTER, RADIUS, CORNER, or CORNERS", - "lineNumber": 21, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "CENTER" - }, - { - "type": "NameExpression", - "name": "RADIUS" - }, - { - "type": "NameExpression", - "name": "CORNER" - }, - { - "type": "NameExpression", - "name": "CORNERS" - } - ] - }, - "name": "mode" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 22 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 23 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 173 - }, - "end": { - "line": 59, - "column": 3, - "index": 1970 - } - }, - "context": { - "loc": { - "start": { - "line": 60, - "column": 0, - "index": 1971 - }, - "end": { - "line": 71, - "column": 2, - "index": 2253 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/attributes.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "mode", - "lineNumber": 21, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either CENTER, RADIUS, CORNER, or CORNERS" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "CENTER" - }, - { - "type": "NameExpression", - "name": "RADIUS" - }, - { - "type": "NameExpression", - "name": "CORNER" - }, - { - "type": "NameExpression", - "name": "CORNERS" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "ellipseMode", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ellipseMode", - "kind": "function" - } - ], - "namespace": "ellipseMode" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Draws all geometry with jagged (aliased) edges." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "smooth()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is active by default in 2D mode. It's necessary to call\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noSmooth()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to disable smoothing of geometry, images, and fonts." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "In WebGL mode, " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noSmooth()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is active by default. It's necessary\nto call " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "smooth()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to draw smooth (antialiased) edges." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "noSmooth" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 73, - "column": 0, - "index": 2255 - }, - "end": { - "line": 96, - "column": 3, - "index": 2957 - } - }, - "context": { - "loc": { - "start": { - "line": 97, - "column": 0, - "index": 2958 - }, - "end": { - "line": 106, - "column": 2, - "index": 3223 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/attributes.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "noSmooth", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "noSmooth", - "kind": "function" - } - ], - "namespace": "noSmooth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "inlineCode", - "value": "rectMode(CORNER)" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "rectMode(CORNERS)" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "rectMode(CENTER)" - }, - { - "type": "text", - "value": " uses the first two parameters as the x- and y-coordinates of\nthe shape's center. The next parameters are its width and height." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "rectMode(RADIUS)" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The argument passed to " - }, - { - "type": "inlineCode", - "value": "rectMode()" - }, - { - "type": "text", - "value": " must be written in ALL CAPS because the\nconstants " - }, - { - "type": "inlineCode", - "value": "CENTER" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "RADIUS" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "CORNER" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "CORNERS" - }, - { - "type": "text", - "value": " are defined this way.\nJavaScript is a case-sensitive language." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 21, - "name": "rectMode" - }, - { - "title": "param", - "description": "either CORNER, CORNERS, CENTER, or RADIUS", - "lineNumber": 22, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "CENTER" - }, - { - "type": "NameExpression", - "name": "RADIUS" - }, - { - "type": "NameExpression", - "name": "CORNER" - }, - { - "type": "NameExpression", - "name": "CORNERS" - } - ] - }, - "name": "mode" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 23 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 24 - } - ], - "loc": { - "start": { - "line": 108, - "column": 0, - "index": 3225 - }, - "end": { - "line": 160, - "column": 3, - "index": 4860 - } - }, - "context": { - "loc": { - "start": { - "line": 161, - "column": 0, - "index": 4861 - }, - "end": { - "line": 172, - "column": 2, - "index": 5134 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/attributes.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "mode", - "lineNumber": 22, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either CORNER, CORNERS, CENTER, or RADIUS" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "CENTER" - }, - { - "type": "NameExpression", - "name": "RADIUS" - }, - { - "type": "NameExpression", - "name": "CORNER" - }, - { - "type": "NameExpression", - "name": "CORNERS" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "rectMode", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "rectMode", - "kind": "function" - } - ], - "namespace": "rectMode" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Draws all geometry with smooth (anti-aliased) edges. " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "smooth()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " will also\nimprove image quality of resized images." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "smooth()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is active by default in 2D mode. It's necessary to call\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noSmooth()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to disable smoothing of geometry, images, and fonts." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "In WebGL mode, " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noSmooth()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is active by default. It's necessary\nto call " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "smooth()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to draw smooth (antialiased) edges." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 10, - "name": "smooth" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 174, - "column": 0, - "index": 5136 - }, - "end": { - "line": 198, - "column": 3, - "index": 5930 - } - }, - "context": { - "loc": { - "start": { - "line": 199, - "column": 0, - "index": 5931 - }, - "end": { - "line": 207, - "column": 2, - "index": 6179 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/attributes.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "smooth", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "smooth", - "kind": "function" - } - ], - "namespace": "smooth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the style for rendering line endings. These ends are either rounded\n(" - }, - { - "type": "inlineCode", - "value": "ROUND" - }, - { - "type": "text", - "value": "), squared (" - }, - { - "type": "inlineCode", - "value": "SQUARE" - }, - { - "type": "text", - "value": "), or extended (" - }, - { - "type": "inlineCode", - "value": "PROJECT" - }, - { - "type": "text", - "value": "). The default cap is\n" - }, - { - "type": "inlineCode", - "value": "ROUND" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The argument passed to " - }, - { - "type": "inlineCode", - "value": "strokeCap()" - }, - { - "type": "text", - "value": " must be written in ALL CAPS because\nthe constants " - }, - { - "type": "inlineCode", - "value": "ROUND" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "SQUARE" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "PROJECT" - }, - { - "type": "text", - "value": " are defined this way.\nJavaScript is a case-sensitive language." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "strokeCap" - }, - { - "title": "param", - "description": "either ROUND, SQUARE, or PROJECT", - "lineNumber": 10, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "ROUND" - }, - { - "type": "NameExpression", - "name": "SQUARE" - }, - { - "type": "NameExpression", - "name": "PROJECT" - } - ] - }, - "name": "cap" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 209, - "column": 0, - "index": 6181 - }, - "end": { - "line": 234, - "column": 3, - "index": 7027 - } - }, - "context": { - "loc": { - "start": { - "line": 235, - "column": 0, - "index": 7028 - }, - "end": { - "line": 245, - "column": 2, - "index": 7281 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/attributes.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "cap", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either ROUND, SQUARE, or PROJECT" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "ROUND" - }, - { - "type": "NameExpression", - "name": "SQUARE" - }, - { - "type": "NameExpression", - "name": "PROJECT" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "strokeCap", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "strokeCap", - "kind": "function" - } - ], - "namespace": "strokeCap" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the style of the joints which connect line segments. These joints are\neither mitered (" - }, - { - "type": "inlineCode", - "value": "MITER" - }, - { - "type": "text", - "value": "), beveled (" - }, - { - "type": "inlineCode", - "value": "BEVEL" - }, - { - "type": "text", - "value": "), or rounded (" - }, - { - "type": "inlineCode", - "value": "ROUND" - }, - { - "type": "text", - "value": "). The default\njoint is " - }, - { - "type": "inlineCode", - "value": "MITER" - }, - { - "type": "text", - "value": " in 2D mode and " - }, - { - "type": "inlineCode", - "value": "ROUND" - }, - { - "type": "text", - "value": " in WebGL mode." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The argument passed to " - }, - { - "type": "inlineCode", - "value": "strokeJoin()" - }, - { - "type": "text", - "value": " must be written in ALL CAPS because\nthe constants " - }, - { - "type": "inlineCode", - "value": "MITER" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "BEVEL" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "ROUND" - }, - { - "type": "text", - "value": " are defined this way.\nJavaScript is a case-sensitive language." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "strokeJoin" - }, - { - "title": "param", - "description": "either MITER, BEVEL, or ROUND", - "lineNumber": 10, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "MITER" - }, - { - "type": "NameExpression", - "name": "BEVEL" - }, - { - "type": "NameExpression", - "name": "ROUND" - } - ] - }, - "name": "join" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 247, - "column": 0, - "index": 7283 - }, - "end": { - "line": 301, - "column": 3, - "index": 8645 - } - }, - "context": { - "loc": { - "start": { - "line": 302, - "column": 0, - "index": 8646 - }, - "end": { - "line": 312, - "column": 2, - "index": 8904 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/attributes.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "join", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either MITER, BEVEL, or ROUND" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "MITER" - }, - { - "type": "NameExpression", - "name": "BEVEL" - }, - { - "type": "NameExpression", - "name": "ROUND" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "strokeJoin", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "strokeJoin", - "kind": "function" - } - ], - "namespace": "strokeJoin" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the width of the stroke used for lines, points, and the border around\nshapes. All widths are set in units of pixels." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note that " - }, - { - "type": "inlineCode", - "value": "strokeWeight()" - }, - { - "type": "text", - "value": " is affected by any transformation or scaling that\nhas been applied previously." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 7, - "name": "strokeWeight" - }, - { - "title": "param", - "description": "the weight of the stroke (in pixels).", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "weight" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 314, - "column": 0, - "index": 8906 - }, - "end": { - "line": 350, - "column": 3, - "index": 9899 - } - }, - "context": { - "loc": { - "start": { - "line": 351, - "column": 0, - "index": 9900 - }, - "end": { - "line": 355, - "column": 2, - "index": 10046 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/attributes.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "weight", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the weight of the stroke (in pixels)." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "strokeWeight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "strokeWeight", - "kind": "function" - } - ], - "namespace": "strokeWeight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Bezier curves were developed by French automotive engineer Pierre Bezier,\nand are commonly used in computer graphics to define gently sloping curves.\nSee also " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "curve()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 13, - "name": "bezier" - }, - { - "title": "param", - "description": "x-coordinate for the first anchor point", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x1" - }, - { - "title": "param", - "description": "y-coordinate for the first anchor point", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y1" - }, - { - "title": "param", - "description": "x-coordinate for the first control point", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x2" - }, - { - "title": "param", - "description": "y-coordinate for the first control point", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y2" - }, - { - "title": "param", - "description": "x-coordinate for the second control point", - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x3" - }, - { - "title": "param", - "description": "y-coordinate for the second control point", - "lineNumber": 19, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y3" - }, - { - "title": "param", - "description": "x-coordinate for the second anchor point", - "lineNumber": 20, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x4" - }, - { - "title": "param", - "description": "y-coordinate for the second anchor point", - "lineNumber": 21, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y4" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 22 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 23 - }, - { - "title": "alt", - "description": "stretched black s-shape in center with orange lines extending from end points.\na white colored curve on black background from the upper-right corner to the lower right corner.", - "lineNumber": 44 - } - ], - "loc": { - "start": { - "line": 13, - "column": 0, - "index": 227 - }, - "end": { - "line": 60, - "column": 3, - "index": 1995 - } - }, - "context": { - "loc": { - "start": { - "line": 78, - "column": 0, - "index": 2477 - }, - "end": { - "line": 90, - "column": 2, - "index": 2803 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/curves.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x1", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate for the first anchor point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y1", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate for the first anchor point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x2", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate for the first control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y2", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate for the first control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x3", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate for the second control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y3", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate for the second control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x4", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate for the second anchor point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y4", - "lineNumber": 21, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate for the second anchor point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "bezier", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "bezier", - "kind": "function" - } - ], - "namespace": "bezier" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "bezier" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x1" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y1" - }, - { - "title": "param", - "description": "z-coordinate for the first anchor point", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z1" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x2" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y2" - }, - { - "title": "param", - "description": "z-coordinate for the first control point", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z2" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x3" - }, - { - "title": "param", - "description": null, - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y3" - }, - { - "title": "param", - "description": "z-coordinate for the second control point", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z3" - }, - { - "title": "param", - "description": null, - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x4" - }, - { - "title": "param", - "description": null, - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y4" - }, - { - "title": "param", - "description": "z-coordinate for the second anchor point", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z4" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 62, - "column": 0, - "index": 1997 - }, - "end": { - "line": 77, - "column": 3, - "index": 2476 - } - }, - "context": { - "loc": { - "start": { - "line": 78, - "column": 0, - "index": 2477 - }, - "end": { - "line": 90, - "column": 2, - "index": 2803 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/curves.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x1", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y1", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z1", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z-coordinate for the first anchor point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x2", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y2", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z2", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z-coordinate for the first control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x3", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y3", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z3", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z-coordinate for the second control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x4", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y4", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z4", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z-coordinate for the second anchor point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "bezier", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "bezier", - "kind": "function" - } - ], - "namespace": "bezier" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the resolution at which Bezier's curve is displayed. The default value is 20." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note, This function is only useful when using the WEBGL renderer\nas the default canvas renderer does not use this information." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "bezierDetail" - }, - { - "title": "param", - "description": "resolution of the curves", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "detail" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "stretched black s-shape with a low level of bezier detail", - "lineNumber": 30 - } - ], - "loc": { - "start": { - "line": 92, - "column": 0, - "index": 2805 - }, - "end": { - "line": 124, - "column": 3, - "index": 3517 - } - }, - "context": { - "loc": { - "start": { - "line": 125, - "column": 0, - "index": 3518 - }, - "end": { - "line": 129, - "column": 2, - "index": 3656 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/curves.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "detail", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "resolution of the curves" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "bezierDetail", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "bezierDetail", - "kind": "function" - } - ], - "namespace": "bezierDetail" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "bezierPoint" - }, - { - "title": "param", - "description": "coordinate of first point on the curve", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "a" - }, - { - "title": "param", - "description": "coordinate of first control point", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "b" - }, - { - "title": "param", - "description": "coordinate of second control point", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "c" - }, - { - "title": "param", - "description": "coordinate of second point on the curve", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "d" - }, - { - "title": "param", - "description": "value between 0 and 1", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "t" - }, - { - "title": "return", - "description": "the value of the Bezier at position t", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 16 - }, - { - "title": "alt", - "description": "10 points plotted on a given bezier at equal distances.", - "lineNumber": 40 - } - ], - "loc": { - "start": { - "line": 131, - "column": 0, - "index": 3658 - }, - "end": { - "line": 173, - "column": 3, - "index": 5032 - } - }, - "context": { - "loc": { - "start": { - "line": 174, - "column": 0, - "index": 5033 - }, - "end": { - "line": 184, - "column": 2, - "index": 5322 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/curves.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "a", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "coordinate of first point on the curve" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "b", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "coordinate of first control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "c", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "coordinate of second control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "d", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "coordinate of second point on the curve" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "t", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value between 0 and 1" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the value of the Bezier at position t" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "bezierPoint", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "bezierPoint", - "kind": "function" - } - ], - "namespace": "bezierPoint" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "bezierTangent" - }, - { - "title": "param", - "description": "coordinate of first point on the curve", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "a" - }, - { - "title": "param", - "description": "coordinate of first control point", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "b" - }, - { - "title": "param", - "description": "coordinate of second control point", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "c" - }, - { - "title": "param", - "description": "coordinate of second point on the curve", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "d" - }, - { - "title": "param", - "description": "value between 0 and 1", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "t" - }, - { - "title": "return", - "description": "the tangent at position t", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 61 - } - ], - "loc": { - "start": { - "line": 186, - "column": 0, - "index": 5324 - }, - "end": { - "line": 250, - "column": 3, - "index": 7401 - } - }, - "context": { - "loc": { - "start": { - "line": 251, - "column": 0, - "index": 7402 - }, - "end": { - "line": 263, - "column": 2, - "index": 7743 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/curves.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "a", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "coordinate of first point on the curve" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "b", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "coordinate of first control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "c", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "coordinate of second control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "d", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "coordinate of second point on the curve" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "t", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value between 0 and 1" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the tangent at position t" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "bezierTangent", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "bezierTangent", - "kind": "function" - } - ], - "namespace": "bezierTangent" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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. " - }, - { - "type": "html", - "value": "
" - }, - { - "type": "html", - "value": "
" - }, - { - "type": "text", - "value": "\nLonger curves can be created by putting a series of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "curve()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " functions\ntogether or using " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "curveVertex()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". An additional function called\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "curveTightness()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " provides control for the visual quality of the curve.\nThe " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "curve()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is an implementation of Catmull-Rom splines." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 10, - "name": "curve" - }, - { - "title": "param", - "description": "x-coordinate for the beginning control point", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x1" - }, - { - "title": "param", - "description": "y-coordinate for the beginning control point", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y1" - }, - { - "title": "param", - "description": "x-coordinate for the first point", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x2" - }, - { - "title": "param", - "description": "y-coordinate for the first point", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y2" - }, - { - "title": "param", - "description": "x-coordinate for the second point", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x3" - }, - { - "title": "param", - "description": "y-coordinate for the second point", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y3" - }, - { - "title": "param", - "description": "x-coordinate for the ending control point", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x4" - }, - { - "title": "param", - "description": "y-coordinate for the ending control point", - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y4" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 19 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 20 - }, - { - "title": "alt", - "description": "horseshoe shape with orange ends facing left and black curved center.\nhorseshoe shape with orange ends facing left and black curved center.\ncurving black and orange lines.", - "lineNumber": 62 - } - ], - "loc": { - "start": { - "line": 265, - "column": 0, - "index": 7745 - }, - "end": { - "line": 331, - "column": 3, - "index": 10152 - } - }, - "context": { - "loc": { - "start": { - "line": 349, - "column": 0, - "index": 10623 - }, - "end": { - "line": 357, - "column": 2, - "index": 10797 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/curves.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x1", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate for the beginning control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y1", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate for the beginning control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x2", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate for the first point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y2", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate for the first point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x3", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate for the second point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y3", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate for the second point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x4", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate for the ending control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y4", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate for the ending control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "curve", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "curve", - "kind": "function" - } - ], - "namespace": "curve" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "curve" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x1" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y1" - }, - { - "title": "param", - "description": "z-coordinate for the beginning control point", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z1" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x2" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y2" - }, - { - "title": "param", - "description": "z-coordinate for the first point", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z2" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x3" - }, - { - "title": "param", - "description": null, - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y3" - }, - { - "title": "param", - "description": "z-coordinate for the second point", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z3" - }, - { - "title": "param", - "description": null, - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x4" - }, - { - "title": "param", - "description": null, - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y4" - }, - { - "title": "param", - "description": "z-coordinate for the ending control point", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z4" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 333, - "column": 0, - "index": 10154 - }, - "end": { - "line": 348, - "column": 3, - "index": 10622 - } - }, - "context": { - "loc": { - "start": { - "line": 349, - "column": 0, - "index": 10623 - }, - "end": { - "line": 357, - "column": 2, - "index": 10797 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/curves.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x1", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y1", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z1", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z-coordinate for the beginning control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x2", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y2", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z2", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z-coordinate for the first point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x3", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y3", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z3", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z-coordinate for the second point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x4", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y4", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z4", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z-coordinate for the ending control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "curve", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "curve", - "kind": "function" - } - ], - "namespace": "curve" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the resolution at which curves display. The default value is 20 while\nthe minimum value is 3." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is only useful when using the WEBGL renderer\nas the default canvas renderer does not use this\ninformation." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "curveDetail" - }, - { - "title": "param", - "description": "resolution of the curves", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "resolution" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - }, - { - "title": "alt", - "description": "white arch shape with a low level of curve detail.", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 359, - "column": 0, - "index": 10799 - }, - "end": { - "line": 388, - "column": 3, - "index": 11474 - } - }, - "context": { - "loc": { - "start": { - "line": 389, - "column": 0, - "index": 11475 - }, - "end": { - "line": 397, - "column": 2, - "index": 11669 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/curves.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "resolution", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "resolution of the curves" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "curveDetail", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "curveDetail", - "kind": "function" - } - ], - "namespace": "curveDetail" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Modifies the quality of forms created with " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "curve()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nand " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "curveVertex()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "curveTightness" - }, - { - "title": "param", - "description": "amount of deformation from the original vertices", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "amount" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - }, - { - "title": "alt", - "description": "Line shaped like right-facing arrow,points move with mouse-x and warp shape.", - "lineNumber": 37 - } - ], - "loc": { - "start": { - "line": 399, - "column": 0, - "index": 11671 - }, - "end": { - "line": 438, - "column": 3, - "index": 12932 - } - }, - "context": { - "loc": { - "start": { - "line": 439, - "column": 0, - "index": 12933 - }, - "end": { - "line": 443, - "column": 2, - "index": 13087 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/curves.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "amount", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "amount of deformation from the original vertices" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "curveTightness", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "curveTightness", - "kind": "function" - } - ], - "namespace": "curveTightness" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 7, - "name": "curvePoint" - }, - { - "title": "param", - "description": "coordinate of first control point of the curve", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "a" - }, - { - "title": "param", - "description": "coordinate of first point", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "b" - }, - { - "title": "param", - "description": "coordinate of second point", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "c" - }, - { - "title": "param", - "description": "coordinate of second control point", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "d" - }, - { - "title": "param", - "description": "value between 0 and 1", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "t" - }, - { - "title": "return", - "description": "Curve value at position t", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 445, - "column": 0, - "index": 13089 - }, - "end": { - "line": 481, - "column": 3, - "index": 14343 - } - }, - "context": { - "loc": { - "start": { - "line": 482, - "column": 0, - "index": 14344 - }, - "end": { - "line": 492, - "column": 2, - "index": 14793 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/curves.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "a", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "coordinate of first control point of the curve" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "b", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "coordinate of first point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "c", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "coordinate of second point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "d", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "coordinate of second control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "t", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value between 0 and 1" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Curve" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " value at position t" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "curvePoint", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "curvePoint", - "kind": "function" - } - ], - "namespace": "curvePoint" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "curveTangent" - }, - { - "title": "param", - "description": "coordinate of first control point", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "a" - }, - { - "title": "param", - "description": "coordinate of first point on the curve", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "b" - }, - { - "title": "param", - "description": "coordinate of second point on the curve", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "c" - }, - { - "title": "param", - "description": "coordinate of second conrol point", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "d" - }, - { - "title": "param", - "description": "value between 0 and 1", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "t" - }, - { - "title": "return", - "description": "the tangent at position t", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - }, - { - "title": "alt", - "description": "right curving line mid-right of canvas with 7 short lines radiating from it.", - "lineNumber": 32 - } - ], - "loc": { - "start": { - "line": 494, - "column": 0, - "index": 14795 - }, - "end": { - "line": 528, - "column": 3, - "index": 15926 - } - }, - "context": { - "loc": { - "start": { - "line": 529, - "column": 0, - "index": 15927 - }, - "end": { - "line": 540, - "column": 2, - "index": 16372 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/curves.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "a", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "coordinate of first control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "b", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "coordinate of first point on the curve" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "c", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "coordinate of second point on the curve" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "d", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "coordinate of second conrol point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "t", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value between 0 and 1" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the tangent at position t" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "curveTangent", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "curveTangent", - "kind": "function" - } - ], - "namespace": "curveTangent" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginContour()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endContour()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " functions to create negative shapes\nwithin shapes such as the center of the letter 'O'. " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginContour()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nbegins recording vertices for the shape and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endContour()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "These functions can only be used within a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "/" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " pair and\ntransformations such as " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "translate()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "rotate()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "scale()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " do not work\nwithin a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginContour()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "/" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endContour()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " pair. It is also not possible to use\nother shapes, such as " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "ellipse()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "rect()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " within." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 14, - "name": "beginContour" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 15 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 16 - }, - { - "title": "alt", - "description": "white rect and smaller grey rect with red outlines in center of canvas.", - "lineNumber": 38 - } - ], - "loc": { - "start": { - "line": 20, - "column": 0, - "index": 354 - }, - "end": { - "line": 60, - "column": 3, - "index": 2046 - } - }, - "context": { - "loc": { - "start": { - "line": 61, - "column": 0, - "index": 2047 - }, - "end": { - "line": 69, - "column": 2, - "index": 2233 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/vertex.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "beginContour", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "beginContour", - "kind": "function" - } - ], - "namespace": "beginContour" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Using the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " functions allow creating more\ncomplex forms. " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " begins recording vertices for a shape and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The parameters available for " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " are:" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "POINTS\nDraw a series of points" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "LINES\nDraw a series of unconnected line segments (individual lines)" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "TRIANGLES\nDraw a series of separate triangles" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "TRIANGLE_FAN\nDraw a series of connected triangles sharing the first vertex in a fan-like fashion" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "TRIANGLE_STRIP\nDraw a series of connected triangles in strip fashion" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "QUADS\nDraw a series of separate quads" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "QUAD_STRIP\nDraw quad strip using adjacent edges to form the next quad" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "TESS (WEBGL only)\nHandle irregular polygon for filling curve by explicit tessellation" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "After calling the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function, a series of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "vertex()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " commands must follow. To stop\ndrawing the shape, call " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". Each shape will be outlined with the\ncurrent stroke color and filled with the fill color." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Transformations such as " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "translate()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "rotate()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "scale()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " do not work\nwithin " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". It is also not possible to use other shapes, such as\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "ellipse()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "rect()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " within " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 41, - "name": "beginShape" - }, - { - "title": "param", - "description": "either POINTS, LINES, TRIANGLES, TRIANGLE_FAN\n TRIANGLE_STRIP, QUADS, QUAD_STRIP or TESS", - "lineNumber": 42, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "POINTS" - }, - { - "type": "NameExpression", - "name": "LINES" - }, - { - "type": "NameExpression", - "name": "TRIANGLES" - }, - { - "type": "NameExpression", - "name": "TRIANGLE_FAN" - }, - { - "type": "NameExpression", - "name": "TRIANGLE_STRIP" - }, - { - "type": "NameExpression", - "name": "QUADS" - }, - { - "type": "NameExpression", - "name": "QUAD_STRIP" - }, - { - "type": "NameExpression", - "name": "TESS" - } - ] - } - }, - "name": "kind" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 44 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 45 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 188 - } - ], - "loc": { - "start": { - "line": 71, - "column": 0, - "index": 2235 - }, - "end": { - "line": 271, - "column": 3, - "index": 7251 - } - }, - "context": { - "loc": { - "start": { - "line": 272, - "column": 0, - "index": 7252 - }, - "end": { - "line": 295, - "column": 2, - "index": 7844 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/vertex.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "kind", - "lineNumber": 42, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either POINTS, LINES, TRIANGLES, TRIANGLE_FAN\nTRIANGLE_STRIP, QUADS, QUAD_STRIP or TESS" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "POINTS" - }, - { - "type": "NameExpression", - "name": "LINES" - }, - { - "type": "NameExpression", - "name": "TRIANGLES" - }, - { - "type": "NameExpression", - "name": "TRIANGLE_FAN" - }, - { - "type": "NameExpression", - "name": "TRIANGLE_STRIP" - }, - { - "type": "NameExpression", - "name": "QUADS" - }, - { - "type": "NameExpression", - "name": "QUAD_STRIP" - }, - { - "type": "NameExpression", - "name": "TESS" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "beginShape", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "beginShape", - "kind": "function" - } - ], - "namespace": "beginShape" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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)." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first time bezierVertex() is used within a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ncall, it must be prefaced with a call to " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "vertex()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to set the first anchor\npoint. This function must be used between " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nand only when there is no MODE or POINTS parameter specified to\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 14, - "name": "bezierVertex" - }, - { - "title": "param", - "description": "x-coordinate for the first control point", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x2" - }, - { - "title": "param", - "description": "y-coordinate for the first control point", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y2" - }, - { - "title": "param", - "description": "x-coordinate for the second control point", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x3" - }, - { - "title": "param", - "description": "y-coordinate for the second control point", - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y3" - }, - { - "title": "param", - "description": "x-coordinate for the anchor point", - "lineNumber": 19, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x4" - }, - { - "title": "param", - "description": "y-coordinate for the anchor point", - "lineNumber": 20, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y4" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 21 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 23 - }, - { - "title": "alt", - "description": "crescent-shaped line in middle of canvas. Points facing left.\nwhite crescent shape in middle of canvas. Points facing left.\ncrescent shape in middle of canvas with another crescent shape on positive z-axis.", - "lineNumber": 76 - } - ], - "loc": { - "start": { - "line": 297, - "column": 0, - "index": 7846 - }, - "end": { - "line": 377, - "column": 3, - "index": 10256 - } - }, - "context": { - "loc": { - "start": { - "line": 392, - "column": 0, - "index": 10679 - }, - "end": { - "line": 417, - "column": 2, - "index": 11321 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/vertex.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x2", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate for the first control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y2", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate for the first control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x3", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate for the second control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y3", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate for the second control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x4", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate for the anchor point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y4", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate for the anchor point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "bezierVertex", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "bezierVertex", - "kind": "function" - } - ], - "namespace": "bezierVertex" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "bezierVertex" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x2" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y2" - }, - { - "title": "param", - "description": "z-coordinate for the first control point (for WebGL mode)", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z2" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x3" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y3" - }, - { - "title": "param", - "description": "z-coordinate for the second control point (for WebGL mode)", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z3" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x4" - }, - { - "title": "param", - "description": null, - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y4" - }, - { - "title": "param", - "description": "z-coordinate for the anchor point (for WebGL mode)", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z4" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 379, - "column": 0, - "index": 10258 - }, - "end": { - "line": 391, - "column": 3, - "index": 10678 - } - }, - "context": { - "loc": { - "start": { - "line": 392, - "column": 0, - "index": 10679 - }, - "end": { - "line": 417, - "column": 2, - "index": 11321 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/vertex.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x2", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y2", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z2", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z-coordinate for the first control point (for WebGL mode)" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x3", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y3", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z3", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z-coordinate for the second control point (for WebGL mode)" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x4", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y4", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z4", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z-coordinate for the anchor point (for WebGL mode)" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "bezierVertex", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "bezierVertex", - "kind": "function" - } - ], - "namespace": "bezierVertex" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Specifies vertex coordinates for curves. This function may only\nbe used between " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and only when there\nis no MODE parameter specified to " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 15, - "name": "curveVertex" - }, - { - "title": "param", - "description": "x-coordinate of the vertex", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y-coordinate of the vertex", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 18 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 19 - }, - { - "title": "alt", - "description": "Upside-down u-shape line, mid canvas. left point extends beyond canvas view.", - "lineNumber": 41 - } - ], - "loc": { - "start": { - "line": 419, - "column": 0, - "index": 11323 - }, - "end": { - "line": 462, - "column": 3, - "index": 12741 - } - }, - "context": { - "loc": { - "start": { - "line": 517, - "column": 0, - "index": 13842 - }, - "end": { - "line": 526, - "column": 2, - "index": 14094 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/vertex.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the vertex" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the vertex" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "curveVertex", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "curveVertex", - "kind": "function" - } - ], - "namespace": "curveVertex" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "curveVertex" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "z-coordinate of the vertex (for WebGL mode)", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "z" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - }, - { - "title": "alt", - "description": "Upside-down u-shape line, mid canvas with the same shape in positive z-axis.", - "lineNumber": 50 - } - ], - "loc": { - "start": { - "line": 464, - "column": 0, - "index": 12743 - }, - "end": { - "line": 516, - "column": 3, - "index": 13841 - } - }, - "context": { - "loc": { - "start": { - "line": 517, - "column": 0, - "index": 13842 - }, - "end": { - "line": 526, - "column": 2, - "index": 14094 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/vertex.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z-coordinate of the vertex (for WebGL mode)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "curveVertex", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "curveVertex", - "kind": "function" - } - ], - "namespace": "curveVertex" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginContour()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endContour()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " functions to create negative\nshapes within shapes such as the center of the letter 'O'. " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginContour()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nbegins recording vertices for the shape and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endContour()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "These functions can only be used within a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "/" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " pair and\ntransformations such as " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "translate()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "rotate()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "scale()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " do not work\nwithin a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginContour()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "/" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endContour()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " pair. It is also not possible to use\nother shapes, such as " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "ellipse()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "rect()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " within." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 14, - "name": "endContour" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 15 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 16 - }, - { - "title": "alt", - "description": "white rect and smaller grey rect with red outlines in center of canvas.", - "lineNumber": 38 - } - ], - "loc": { - "start": { - "line": 528, - "column": 0, - "index": 14096 - }, - "end": { - "line": 568, - "column": 3, - "index": 15786 - } - }, - "context": { - "loc": { - "start": { - "line": 569, - "column": 0, - "index": 15787 - }, - "end": { - "line": 589, - "column": 2, - "index": 16285 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/vertex.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "endContour", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "endContour", - "kind": "function" - } - ], - "namespace": "endContour" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is the companion to " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and may only be\ncalled after " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". When " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is called, all of the image\ndata defined since the previous call to " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is written into the image\nbuffer. The constant CLOSE is the value for the " - }, - { - "type": "inlineCode", - "value": "mode" - }, - { - "type": "text", - "value": " parameter to close\nthe shape (to connect the beginning and the end).\nWhen using instancing with " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "here" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or by working from the example on this\npage." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 14, - "name": "endShape" - }, - { - "title": "param", - "description": "use CLOSE to close the shape", - "lineNumber": 15, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "CLOSE" - } - }, - "name": "mode" - }, - { - "title": "param", - "description": "number of times you want to draw/instance the shape (for WebGL mode).", - "lineNumber": 16, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "count" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 17 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 18 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 37 - }, - { - "title": "alt", - "description": "Triangle line shape with smallest interior angle on bottom and upside-down L.", - "lineNumber": 116 - } - ], - "loc": { - "start": { - "line": 591, - "column": 0, - "index": 16287 - }, - "end": { - "line": 709, - "column": 3, - "index": 19976 - } - }, - "context": { - "loc": { - "start": { - "line": 710, - "column": 0, - "index": 19977 - }, - "end": { - "line": 770, - "column": 2, - "index": 21401 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/vertex.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - }, - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "mode", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "use CLOSE to close the shape" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "CLOSE" - } - } - }, - { - "title": "param", - "name": "count", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of times you want to draw/instance the shape (for WebGL mode)." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "endShape", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "endShape", - "kind": "function" - } - ], - "namespace": "endShape" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " call, it\nmust be prefaced with a call to " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "vertex()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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)." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function must be used between " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nand only when there is no MODE or POINTS parameter specified to\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 14, - "name": "quadraticVertex" - }, - { - "title": "param", - "description": "x-coordinate for the control point", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "cx" - }, - { - "title": "param", - "description": "y-coordinate for the control point", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "cy" - }, - { - "title": "param", - "description": "x-coordinate for the anchor point", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x3" - }, - { - "title": "param", - "description": "y-coordinate for the anchor point", - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y3" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 19 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 21 - }, - { - "title": "alt", - "description": "arched-shaped black line with 4 pixel thick stroke weight.\nbackwards s-shaped black line with 4 pixel thick stroke weight.", - "lineNumber": 60 - } - ], - "loc": { - "start": { - "line": 772, - "column": 0, - "index": 21403 - }, - "end": { - "line": 835, - "column": 3, - "index": 23269 - } - }, - "context": { - "loc": { - "start": { - "line": 890, - "column": 0, - "index": 24425 - }, - "end": { - "line": 928, - "column": 2, - "index": 25415 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/vertex.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "cx", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate for the control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "cy", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate for the control point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x3", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate for the anchor point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y3", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate for the anchor point" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "quadraticVertex", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "quadraticVertex", - "kind": "function" - } - ], - "namespace": "quadraticVertex" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "quadraticVertex" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "cx" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "cy" - }, - { - "title": "param", - "description": "z-coordinate for the control point (for WebGL mode)", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "cz" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x3" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y3" - }, - { - "title": "param", - "description": "z-coordinate for the anchor point (for WebGL mode)", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z3" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "backwards s-shaped black line with the same s-shaped line in positive z-axis.", - "lineNumber": 50 - } - ], - "loc": { - "start": { - "line": 837, - "column": 0, - "index": 23271 - }, - "end": { - "line": 889, - "column": 3, - "index": 24424 - } - }, - "context": { - "loc": { - "start": { - "line": 890, - "column": 0, - "index": 24425 - }, - "end": { - "line": 928, - "column": 2, - "index": 25415 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/vertex.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "cx", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "cy", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "cz", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z-coordinate for the control point (for WebGL mode)" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x3", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y3", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z3", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z-coordinate for the anchor point (for WebGL mode)" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "quadraticVertex", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "quadraticVertex", - "kind": "function" - } - ], - "namespace": "quadraticVertex" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "All shapes are constructed by connecting a series of vertices. " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "vertex()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nis used to specify the vertex coordinates for points, lines, triangles,\nquads, and polygons. It is used exclusively within the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " functions." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "vertex" - }, - { - "title": "param", - "description": "x-coordinate of the vertex", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y-coordinate of the vertex", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "4 black points in a square shape in middle-right of canvas.\n4 points making a diamond shape.\n8 points making a star.\n8 points making 4 lines.\nA rotating 3D shape with a hollow section in the middle.", - "lineNumber": 124 - } - ], - "loc": { - "start": { - "line": 930, - "column": 0, - "index": 25417 - }, - "end": { - "line": 1060, - "column": 3, - "index": 28256 - } - }, - "context": { - "loc": { - "start": { - "line": 1078, - "column": 0, - "index": 28680 - }, - "end": { - "line": 1105, - "column": 2, - "index": 29282 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/vertex.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the vertex" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the vertex" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "vertex", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "vertex", - "kind": "function" - } - ], - "namespace": "vertex" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "vertex" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "z-coordinate of the vertex.\n Defaults to 0 if not specified.", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "z" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 1061, - "column": 0, - "index": 28257 - }, - "end": { - "line": 1068, - "column": 3, - "index": 28451 - } - }, - "context": { - "loc": { - "start": { - "line": 1078, - "column": 0, - "index": 28680 - }, - "end": { - "line": 1105, - "column": 2, - "index": 29282 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/vertex.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z-coordinate of the vertex.\nDefaults to 0 if not specified." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "vertex", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "vertex", - "kind": "function" - } - ], - "namespace": "vertex" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "vertex" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "z" - }, - { - "title": "param", - "description": "the vertex's texture u-coordinate", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "u" - }, - { - "title": "param", - "description": "the vertex's texture v-coordinate", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "v" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 1069, - "column": 0, - "index": 28452 - }, - "end": { - "line": 1077, - "column": 3, - "index": 28679 - } - }, - "context": { - "loc": { - "start": { - "line": 1078, - "column": 0, - "index": 28680 - }, - "end": { - "line": 1105, - "column": 2, - "index": 29282 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/vertex.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "u", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the vertex's texture u-coordinate" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "v", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the vertex's texture v-coordinate" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "vertex", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "vertex", - "kind": "function" - } - ], - "namespace": "vertex" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the 3d vertex normal to use for subsequent vertices drawn with\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "vertex()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "normal" - }, - { - "title": "param", - "description": "A p5.Vector representing the vertex normal.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Vector" - }, - "name": "vector" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 1107, - "column": 0, - "index": 29284 - }, - "end": { - "line": 1142, - "column": 3, - "index": 30149 - } - }, - "context": { - "loc": { - "start": { - "line": 1151, - "column": 0, - "index": 30371 - }, - "end": { - "line": 1157, - "column": 2, - "index": 30545 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/vertex.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "vector", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A p5.Vector representing the vertex normal." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Vector" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "normal", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "normal", - "kind": "function" - } - ], - "namespace": "normal" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "normal" - }, - { - "title": "param", - "description": "The x component of the vertex normal.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "The y component of the vertex normal.", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "The z component of the vertex normal.", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 1144, - "column": 0, - "index": 30151 - }, - "end": { - "line": 1150, - "column": 3, - "index": 30370 - } - }, - "context": { - "loc": { - "start": { - "line": 1151, - "column": 0, - "index": 30371 - }, - "end": { - "line": 1157, - "column": 2, - "index": 30545 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/shape/vertex.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The x component of the vertex normal." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The y component of the vertex normal." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The z component of the vertex normal." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "normal", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "normal", - "kind": "function" - } - ], - "namespace": "normal" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Stops p5.js from continuously executing the code within " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nIf " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is called, the code in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nbegins to run continuously again. If using " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noLoop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nin " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", it should be the last line inside the block." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noLoop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is used, it's not possible to manipulate\nor access the screen inside event handling functions such as\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "mousePressed()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyPressed()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". Instead, use those functions to\ncall " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "redraw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\nwhich will run " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", which can update the screen\nproperly. This means that when " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noLoop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " has been\ncalled, no drawing can happen, and functions like " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "saveFrames()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nor " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadPixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " may not be used." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note that if the sketch is resized, " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "redraw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " will\nbe called to update the sketch, even after " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noLoop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nhas been specified. Otherwise, the sketch would enter an odd state until\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " was called." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "isLooping()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to check the current state of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 23, - "name": "noLoop" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 24 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 108 - }, - "end": { - "line": 77, - "column": 3, - "index": 2276 - } - }, - "context": { - "loc": { - "start": { - "line": 78, - "column": 0, - "index": 2277 - }, - "end": { - "line": 80, - "column": 2, - "index": 2336 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/structure.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "noLoop", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "noLoop", - "kind": "function" - } - ], - "namespace": "noLoop" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "By default, p5.js loops through draw() continuously, executing the code within\nit. However, the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " loop may be stopped by calling\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noLoop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". In that case, the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nloop can be resumed with loop()." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Avoid calling loop() from inside setup()." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "isLooping()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to check the current state of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 10, - "name": "loop" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - }, - { - "title": "alt", - "description": "horizontal line moves slowly from left. Loops but stops on mouse press.", - "lineNumber": 39 - } - ], - "loc": { - "start": { - "line": 82, - "column": 0, - "index": 2338 - }, - "end": { - "line": 123, - "column": 3, - "index": 3279 - } - }, - "context": { - "loc": { - "start": { - "line": 124, - "column": 0, - "index": 3280 - }, - "end": { - "line": 131, - "column": 2, - "index": 3416 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/structure.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "loop", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "loop", - "kind": "function" - } - ], - "namespace": "loop" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "By default, p5.js loops through " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " continuously,\nexecuting the code within it. If the sketch is stopped with\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noLoop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or resumed with " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\nisLooping() returns the current state for use within custom event handlers." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "isLooping" - }, - { - "title": "returns", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "boolean" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - }, - { - "title": "alt", - "description": "Ellipse moves slowly from left. Checkbox toggles loop()/noLoop().\nButton colorizes sketch if isLooping().", - "lineNumber": 50 - } - ], - "loc": { - "start": { - "line": 133, - "column": 0, - "index": 3418 - }, - "end": { - "line": 187, - "column": 3, - "index": 4739 - } - }, - "context": { - "loc": { - "start": { - "line": 188, - "column": 0, - "index": 4740 - }, - "end": { - "line": 190, - "column": 2, - "index": 4801 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/structure.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "boolean" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "isLooping", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "isLooping", - "kind": "function" - } - ], - "namespace": "isLooping" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "push()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function saves the current drawing style\nsettings and transformations, while " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "push()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", it builds on\nthe current style and transform information. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "push()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nand " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " functions can be embedded to provide more\ncontrol. (See the second example for a demonstration.)" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "push()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " stores information related to the current transformation state\nand style settings controlled by the following functions:\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "fill()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noFill()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noStroke()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "stroke()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "tint()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noTint()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "strokeWeight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "strokeCap()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "strokeJoin()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "imageMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "rectMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "ellipseMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "colorMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "textAlign()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "textFont()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "textSize()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "textLeading()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "applyMatrix()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resetMatrix()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "rotate()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "scale()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "shearX()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "shearY()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "translate()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noiseSeed()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "In WEBGL mode additional style settings are stored. These are controlled by the\nfollowing functions: " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setCamera()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "ambientLight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "directionalLight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pointLight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "texture()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "specularMaterial()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "shininess()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "normalMaterial()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nand " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "shader()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 48, - "name": "push" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 49 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 85 - } - ], - "loc": { - "start": { - "line": 192, - "column": 0, - "index": 4803 - }, - "end": { - "line": 280, - "column": 3, - "index": 8213 - } - }, - "context": { - "loc": { - "start": { - "line": 281, - "column": 0, - "index": 8214 - }, - "end": { - "line": 288, - "column": 2, - "index": 8367 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/structure.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "push", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "push", - "kind": "function" - } - ], - "namespace": "push" - }, - { - "description": "", - "tags": [ - { - "title": "function", - "description": null, - "lineNumber": 1, - "name": "push" - }, - { - "title": "param", - "description": "the x positions of points in the curve", - "lineNumber": 2, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "xs" - }, - { - "title": "param", - "description": "the y positions of points in the curve", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "ys" - }, - { - "title": "param", - "description": "the curve information\n\nadds a curve to the rows & columns that it intersects with", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Object" - }, - "name": "v" - } - ], - "loc": { - "start": { - "line": 190, - "column": 4, - "index": 5734 - }, - "end": { - "line": 197, - "column": 9, - "index": 6038 - } - }, - "context": { - "loc": { - "start": { - "line": 198, - "column": 4, - "index": 6043 - }, - "end": { - "line": 249, - "column": 5, - "index": 7860 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/text.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "xs", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the x positions of points in the curve" - } - ] - } - ] - }, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "param", - "name": "ys", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the y positions of points in the curve" - } - ] - } - ] - }, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "param", - "name": "v", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the curve information" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "adds a curve to the rows & columns that it intersects with" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "push", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "push", - "kind": "function" - } - ], - "namespace": "push" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "push()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function saves the current drawing style\nsettings and transformations, while " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "push()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", it\nbuilds on the current style and transform information. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "push()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nand " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " functions can be embedded to provide more\ncontrol. (See the second example for a demonstration.)" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "push()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " stores information related to the current transformation state\nand style settings controlled by the following functions:\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "fill()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noFill()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noStroke()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "stroke()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "tint()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noTint()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "strokeWeight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "strokeCap()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "strokeJoin()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "imageMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "rectMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "ellipseMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "colorMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "textAlign()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "textFont()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "textSize()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "textLeading()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "applyMatrix()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resetMatrix()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "rotate()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "scale()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "shearX()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "shearY()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "translate()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noiseSeed()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "In WEBGL mode additional style settings are stored. These are controlled by\nthe following functions:\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setCamera()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "ambientLight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "directionalLight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pointLight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "texture()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "specularMaterial()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "shininess()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "normalMaterial()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "shader()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 50, - "name": "pop" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 51 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 87 - } - ], - "loc": { - "start": { - "line": 290, - "column": 0, - "index": 8369 - }, - "end": { - "line": 380, - "column": 3, - "index": 11784 - } - }, - "context": { - "loc": { - "start": { - "line": 381, - "column": 0, - "index": 11785 - }, - "end": { - "line": 389, - "column": 2, - "index": 12025 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/structure.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "pop", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "pop", - "kind": "function" - } - ], - "namespace": "pop" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Executes the code within " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " one time. This\nfunction allows the program to update the display window only when necessary,\nfor example when an event registered by " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "mousePressed()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nor " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyPressed()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " occurs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "In structuring a program, it only makes sense to call " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "redraw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nwithin events such as " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "mousePressed()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". This\nis because " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "redraw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " does not run\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " immediately (it only sets a flag that indicates\nan update is needed)." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "redraw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function does not work properly when\ncalled inside " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".To enable/disable animations,\nuse " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noLoop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "In addition you can set the number of redraws per method call. Just\nadd an integer as single parameter for the number of redraws." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 19, - "name": "redraw" - }, - { - "title": "param", - "description": "Redraw for n-times. The default value is 1.", - "lineNumber": 20, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "n" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 21 - }, - { - "title": "alt", - "description": "black line on far left of canvas\nblack line on far left of canvas", - "lineNumber": 63 - } - ], - "loc": { - "start": { - "line": 391, - "column": 0, - "index": 12027 - }, - "end": { - "line": 457, - "column": 3, - "index": 13801 - } - }, - "context": { - "loc": { - "start": { - "line": 458, - "column": 0, - "index": 13802 - }, - "end": { - "line": 492, - "column": 2, - "index": 14827 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/structure.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Redraw for n-times. The default value is 1." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "redraw", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "redraw", - "kind": "function" - } - ], - "namespace": "redraw" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Transform" - }, - { - "title": "submodule", - "description": "Transform", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - }, - { - "title": "requires", - "description": null, - "lineNumber": 5, - "name": "constants" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 7, - "column": 3, - "index": 104 - } - }, - "context": { - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 106 - }, - "end": { - "line": 9, - "column": 24, - "index": 130 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/transform.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Transform", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Transform", - "kind": "module" - } - ], - "namespace": "Transform" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nWikipedia" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The naming of the arguments here follows the naming of the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nWHATWG specification" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and corresponds to a\ntransformation matrix of the\nform:" - } - ] - }, - { - "type": "blockquote", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 19, - "name": "applyMatrix" - }, - { - "title": "param", - "description": "an array of numbers - should be 6 or 16 length (2×3 or 4×4 matrix values)", - "lineNumber": 20, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "arr" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 21 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 22 - }, - { - "title": "alt", - "description": "A rectangle translating to the right\nA rectangle shrinking to the center\nA rectangle rotating clockwise about the center\nA rectangle shearing\nA rectangle in the upper left corner", - "lineNumber": 139 - } - ], - "loc": { - "start": { - "line": 11, - "column": 0, - "index": 132 - }, - "end": { - "line": 156, - "column": 3, - "index": 3640 - } - }, - "context": { - "loc": { - "start": { - "line": 187, - "column": 0, - "index": 5105 - }, - "end": { - "line": 195, - "column": 2, - "index": 5392 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/transform.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "arr", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "an array of numbers - should be 6 or 16 length (2×3 or 4×4 matrix values)" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "applyMatrix", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "applyMatrix", - "kind": "function" - } - ], - "namespace": "applyMatrix" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "applyMatrix" - }, - { - "title": "param", - "description": "numbers which define the 2×3 or 4×4 matrix to be multiplied", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "a" - }, - { - "title": "param", - "description": "numbers which define the 2×3 or 4×4 matrix to be multiplied", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "b" - }, - { - "title": "param", - "description": "numbers which define the 2×3 or 4×4 matrix to be multiplied", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "c" - }, - { - "title": "param", - "description": "numbers which define the 2×3 or 4×4 matrix to be multiplied", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "d" - }, - { - "title": "param", - "description": "numbers which define the 2×3 or 4×4 matrix to be multiplied", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "e" - }, - { - "title": "param", - "description": "numbers which define the 2×3 or 4×4 matrix to be multiplied", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "f" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 157, - "column": 0, - "index": 3641 - }, - "end": { - "line": 166, - "column": 3, - "index": 4177 - } - }, - "context": { - "loc": { - "start": { - "line": 187, - "column": 0, - "index": 5105 - }, - "end": { - "line": 195, - "column": 2, - "index": 5392 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/transform.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "a", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "numbers which define the 2×3 or 4×4 matrix to be multiplied" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "b", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "numbers which define the 2×3 or 4×4 matrix to be multiplied" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "c", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "numbers which define the 2×3 or 4×4 matrix to be multiplied" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "d", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "numbers which define the 2×3 or 4×4 matrix to be multiplied" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "e", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "numbers which define the 2×3 or 4×4 matrix to be multiplied" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "f", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "numbers which define the 2×3 or 4×4 matrix to be multiplied" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "applyMatrix", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "applyMatrix", - "kind": "function" - } - ], - "namespace": "applyMatrix" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "applyMatrix" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "a" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "b" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "c" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "d" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "e" - }, - { - "title": "param", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "f" - }, - { - "title": "param", - "description": "numbers which define the 4×4 matrix to be multiplied", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "g" - }, - { - "title": "param", - "description": "numbers which define the 4×4 matrix to be multiplied", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "h" - }, - { - "title": "param", - "description": "numbers which define the 4×4 matrix to be multiplied", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "i" - }, - { - "title": "param", - "description": "numbers which define the 4×4 matrix to be multiplied", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "j" - }, - { - "title": "param", - "description": "numbers which define the 4×4 matrix to be multiplied", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "k" - }, - { - "title": "param", - "description": "numbers which define the 4×4 matrix to be multiplied", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "l" - }, - { - "title": "param", - "description": "numbers which define the 4×4 matrix to be multiplied", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "m" - }, - { - "title": "param", - "description": "numbers which define the 4×4 matrix to be multiplied", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "n" - }, - { - "title": "param", - "description": "numbers which define the 4×4 matrix to be multiplied", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "o" - }, - { - "title": "param", - "description": "numbers which define the 4×4 matrix to be multiplied", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "p" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 18 - } - ], - "loc": { - "start": { - "line": 167, - "column": 0, - "index": 4178 - }, - "end": { - "line": 186, - "column": 3, - "index": 5104 - } - }, - "context": { - "loc": { - "start": { - "line": 187, - "column": 0, - "index": 5105 - }, - "end": { - "line": 195, - "column": 2, - "index": 5392 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/transform.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "a", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "b", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "c", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "d", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "e", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "f", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "g", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "numbers which define the 4×4 matrix to be multiplied" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "h", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "numbers which define the 4×4 matrix to be multiplied" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "i", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "numbers which define the 4×4 matrix to be multiplied" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "j", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "numbers which define the 4×4 matrix to be multiplied" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "k", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "numbers which define the 4×4 matrix to be multiplied" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "l", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "numbers which define the 4×4 matrix to be multiplied" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "m", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "numbers which define the 4×4 matrix to be multiplied" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "n", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "numbers which define the 4×4 matrix to be multiplied" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "o", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "numbers which define the 4×4 matrix to be multiplied" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "p", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "numbers which define the 4×4 matrix to be multiplied" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "applyMatrix", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "applyMatrix", - "kind": "function" - } - ], - "namespace": "applyMatrix" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Replaces the current matrix with the identity matrix." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 3, - "name": "resetMatrix" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - }, - { - "title": "alt", - "description": "A rotated rectangle in the center with another at the top left corner", - "lineNumber": 17 - } - ], - "loc": { - "start": { - "line": 197, - "column": 0, - "index": 5394 - }, - "end": { - "line": 216, - "column": 3, - "index": 5808 - } - }, - "context": { - "loc": { - "start": { - "line": 217, - "column": 0, - "index": 5809 - }, - "end": { - "line": 220, - "column": 2, - "index": 5898 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/transform.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "resetMatrix", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "resetMatrix", - "kind": "function" - } - ], - "namespace": "resetMatrix" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Rotates a shape by the amount specified by the angle parameter. This\nfunction accounts for " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", so angles\ncan be entered in either RADIANS or DEGREES." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " begins again." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Technically, " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "rotate()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " multiplies the current transformation matrix\nby a rotation matrix. This function can be further controlled by\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "push()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 16, - "name": "rotate" - }, - { - "title": "param", - "description": "the angle of rotation, specified in radians\n or degrees, depending on current angleMode", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "angle" - }, - { - "title": "param", - "description": "(in 3d) the axis to rotate around", - "lineNumber": 19, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - } - }, - "name": "axis" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 20 - }, - { - "title": "example", - "description": "
\n\ntranslate(width / 2, height / 2);\nrotate(PI / 3.0);\nrect(-26, -26, 52, 52);\n\n
", - "lineNumber": 21 - }, - { - "title": "alt", - "description": "white 52×52 rect with black outline at center rotated counter 45 degrees", - "lineNumber": 30 - } - ], - "loc": { - "start": { - "line": 222, - "column": 0, - "index": 5900 - }, - "end": { - "line": 254, - "column": 3, - "index": 7247 - } - }, - "context": { - "loc": { - "start": { - "line": 255, - "column": 0, - "index": 7248 - }, - "end": { - "line": 259, - "column": 2, - "index": 7413 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/transform.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\ntranslate(width / 2, height / 2);\nrotate(PI / 3.0);\nrect(-26, -26, 52, 52);\n\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "angle", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the angle of rotation, specified in radians\nor degrees, depending on current angleMode" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "axis", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "(in 3d) the axis to rotate around" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "rotate", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "rotate", - "kind": "function" - } - ], - "namespace": "rotate" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Rotates a shape around X axis by the amount specified in angle parameter.\nThe angles can be entered in either RADIANS or DEGREES." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " begins again." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "rotateX" - }, - { - "title": "param", - "description": "the angle of rotation, specified in radians\n or degrees, depending on current angleMode", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "angle" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - }, - { - "title": "alt", - "description": "3d box rotating around the x axis.", - "lineNumber": 28 - } - ], - "loc": { - "start": { - "line": 261, - "column": 0, - "index": 7415 - }, - "end": { - "line": 291, - "column": 3, - "index": 8333 - } - }, - "context": { - "loc": { - "start": { - "line": 292, - "column": 0, - "index": 8334 - }, - "end": { - "line": 297, - "column": 2, - "index": 8519 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/transform.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "angle", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the angle of rotation, specified in radians\nor degrees, depending on current angleMode" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "rotateX", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "rotateX", - "kind": "function" - } - ], - "namespace": "rotateX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Rotates a shape around Y axis by the amount specified in angle parameter.\nThe angles can be entered in either RADIANS or DEGREES." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " begins again." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "rotateY" - }, - { - "title": "param", - "description": "the angle of rotation, specified in radians\n or degrees, depending on current angleMode", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "angle" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - }, - { - "title": "alt", - "description": "3d box rotating around the y axis.", - "lineNumber": 28 - } - ], - "loc": { - "start": { - "line": 299, - "column": 0, - "index": 8521 - }, - "end": { - "line": 329, - "column": 3, - "index": 9438 - } - }, - "context": { - "loc": { - "start": { - "line": 330, - "column": 0, - "index": 9439 - }, - "end": { - "line": 335, - "column": 2, - "index": 9624 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/transform.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "angle", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the angle of rotation, specified in radians\nor degrees, depending on current angleMode" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "rotateY", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "rotateY", - "kind": "function" - } - ], - "namespace": "rotateY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Rotates a shape around Z axis by the amount specified in angle parameter.\nThe angles can be entered in either RADIANS or DEGREES." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This method works in WEBGL mode only." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " begins again." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 10, - "name": "rotateZ" - }, - { - "title": "param", - "description": "the angle of rotation, specified in radians\n or degrees, depending on current angleMode", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "angle" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 13 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 14 - }, - { - "title": "alt", - "description": "3d box rotating around the z axis.", - "lineNumber": 30 - } - ], - "loc": { - "start": { - "line": 337, - "column": 0, - "index": 9626 - }, - "end": { - "line": 369, - "column": 3, - "index": 10587 - } - }, - "context": { - "loc": { - "start": { - "line": 370, - "column": 0, - "index": 10588 - }, - "end": { - "line": 375, - "column": 2, - "index": 10773 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/transform.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "angle", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the angle of rotation, specified in radians\nor degrees, depending on current angleMode" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "rotateZ", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "rotateZ", - "kind": "function" - } - ], - "namespace": "rotateZ" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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%." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "scale()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is called\nwithin " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", the transformation is reset when the loop begins again." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Using this function with the z parameter is only available in WEBGL mode.\nThis function can be further controlled with " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "push()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 15, - "name": "scale" - }, - { - "title": "param", - "description": "percent to scale the object, or percentage to\n scale the object in the x-axis if multiple arguments\n are given", - "lineNumber": 16, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - }, - "name": "s" - }, - { - "title": "param", - "description": "percent to scale the object in the y-axis", - "lineNumber": 20, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "y" - }, - { - "title": "param", - "description": "percent to scale the object in the z-axis (webgl only)", - "lineNumber": 21, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "z" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 22 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 23 - }, - { - "title": "alt", - "description": "white 52×52 rect with black outline at center rotated counter 45 degrees\n2 white rects with black outline- 1 50×50 at center. other 25×65 bottom left", - "lineNumber": 40 - } - ], - "loc": { - "start": { - "line": 377, - "column": 0, - "index": 10775 - }, - "end": { - "line": 420, - "column": 3, - "index": 12428 - } - }, - "context": { - "loc": { - "start": { - "line": 426, - "column": 0, - "index": 12545 - }, - "end": { - "line": 449, - "column": 2, - "index": 13037 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/transform.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "s", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "percent to scale the object, or percentage to\nscale the object in the x-axis if multiple arguments\nare given" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "percent to scale the object in the y-axis" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 21, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "percent to scale the object in the z-axis (webgl only)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "scale", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "scale", - "kind": "function" - } - ], - "namespace": "scale" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "scale" - }, - { - "title": "param", - "description": "per-axis percents to scale the object", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - }, - "name": "scales" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 421, - "column": 0, - "index": 12429 - }, - "end": { - "line": 425, - "column": 3, - "index": 12544 - } - }, - "context": { - "loc": { - "start": { - "line": 426, - "column": 0, - "index": 12545 - }, - "end": { - "line": 449, - "column": 2, - "index": 13037 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/transform.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "scales", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "per-axis percents to scale the object" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Vector" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "scale", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "scale", - "kind": "function" - } - ], - "namespace": "scale" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "shearX()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is called within the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\nthe transformation is reset when the loop begins again." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Technically, " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "shearX()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " multiplies the current\ntransformation matrix by a rotation matrix. This function can be further\ncontrolled by the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "push()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " functions." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 16, - "name": "shearX" - }, - { - "title": "param", - "description": "angle of shear specified in radians or degrees,\n depending on current angleMode", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "angle" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 19 - }, - { - "title": "example", - "description": "
\n\ntranslate(width / 4, height / 4);\nshearX(PI / 4.0);\nrect(0, 0, 30, 30);\n\n
", - "lineNumber": 20 - }, - { - "title": "alt", - "description": "white irregular quadrilateral with black outline at top middle.", - "lineNumber": 29 - } - ], - "loc": { - "start": { - "line": 451, - "column": 0, - "index": 13039 - }, - "end": { - "line": 482, - "column": 3, - "index": 14315 - } - }, - "context": { - "loc": { - "start": { - "line": 483, - "column": 0, - "index": 14316 - }, - "end": { - "line": 488, - "column": 2, - "index": 14518 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/transform.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\ntranslate(width / 4, height / 4);\nshearX(PI / 4.0);\nrect(0, 0, 30, 30);\n\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "angle", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "angle of shear specified in radians or degrees,\ndepending on current angleMode" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "shearX", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "shearX", - "kind": "function" - } - ], - "namespace": "shearX" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "shearY()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is called within the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", the transformation is reset when\nthe loop begins again." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Technically, " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "shearY()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " multiplies the current transformation matrix by a\nrotation matrix. This function can be further controlled by the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "push()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " functions." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 16, - "name": "shearY" - }, - { - "title": "param", - "description": "angle of shear specified in radians or degrees,\n depending on current angleMode", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "angle" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 19 - }, - { - "title": "example", - "description": "
\n\ntranslate(width / 4, height / 4);\nshearY(PI / 4.0);\nrect(0, 0, 30, 30);\n\n
", - "lineNumber": 20 - }, - { - "title": "alt", - "description": "white irregular quadrilateral with black outline at middle bottom.", - "lineNumber": 29 - } - ], - "loc": { - "start": { - "line": 490, - "column": 0, - "index": 14520 - }, - "end": { - "line": 521, - "column": 3, - "index": 15796 - } - }, - "context": { - "loc": { - "start": { - "line": 522, - "column": 0, - "index": 15797 - }, - "end": { - "line": 527, - "column": 2, - "index": 15999 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/transform.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\ntranslate(width / 4, height / 4);\nshearY(PI / 4.0);\nrect(0, 0, 30, 30);\n\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "angle", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "angle of shear specified in radians or degrees,\ndepending on current angleMode" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "shearY", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "shearY", - "kind": "function" - } - ], - "namespace": "shearY" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Specifies an amount to displace objects within the display window.\nThe x parameter specifies left/right translation, the y parameter\nspecifies up/down translation." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "translate()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is called within " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", the\ntransformation is reset when the loop begins again. This function can be\nfurther controlled by using " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "push()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 12, - "name": "translate" - }, - { - "title": "param", - "description": "left/right translation", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "up/down translation", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "forward/backward translation (WEBGL only)", - "lineNumber": 15, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "z" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 16 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 17 - }, - { - "title": "alt", - "description": "white 55×55 rect with black outline at center right.\n3 white 55×55 rects with black outlines at top-l, center-r and bottom-r.\na 20×20 white rect moving in a circle around the canvas", - "lineNumber": 48 - } - ], - "loc": { - "start": { - "line": 529, - "column": 0, - "index": 16001 - }, - "end": { - "line": 581, - "column": 3, - "index": 17657 - } - }, - "context": { - "loc": { - "start": { - "line": 587, - "column": 0, - "index": 17758 - }, - "end": { - "line": 595, - "column": 2, - "index": 17990 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/transform.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "left/right translation" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "up/down translation" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "forward/backward translation (WEBGL only)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "translate", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "translate", - "kind": "function" - } - ], - "namespace": "translate" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "translate" - }, - { - "title": "param", - "description": "the vector to translate by", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "vector" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 582, - "column": 0, - "index": 17658 - }, - "end": { - "line": 586, - "column": 3, - "index": 17757 - } - }, - "context": { - "loc": { - "start": { - "line": 587, - "column": 0, - "index": 17758 - }, - "end": { - "line": 595, - "column": 2, - "index": 17990 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/core/transform.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "vector", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the vector to translate by" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "translate", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "translate", - "kind": "function" - } - ], - "namespace": "translate" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Data" - }, - { - "title": "submodule", - "description": "LocalStorage", - "lineNumber": 2 - }, - { - "title": "requires", - "description": null, - "lineNumber": 3, - "name": "core", - "errors": [ - "Unknown content 'This module defines the p5 methods for working with local storage'" - ] - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 7, - "column": 3, - "index": 140 - } - }, - "context": { - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 142 - }, - "end": { - "line": 9, - "column": 30, - "index": 172 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/local_storage.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Data", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Data", - "kind": "module" - } - ], - "namespace": "Data" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Data" - }, - { - "title": "submodule", - "description": "Dictionary", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5.TypedDict", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core", - "errors": [ - "Unknown content 'This module defines the p5 methods for the p5 Dictionary classes.\nThe classes StringDict and NumberDict are for storing and working\nwith key-value pairs.'" - ] - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 10, - "column": 3, - "index": 253 - } - }, - "context": { - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 255 - }, - "end": { - "line": 12, - "column": 30, - "index": 285 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Data", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Data", - "kind": "module" - } - ], - "namespace": "Data" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Data" - }, - { - "title": "submodule", - "description": "Array Functions", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 82 - } - }, - "context": { - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 84 - }, - "end": { - "line": 8, - "column": 30, - "index": 114 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/array_functions.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Data", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Data", - "kind": "module" - } - ], - "namespace": "Data" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Data" - }, - { - "title": "submodule", - "description": "Conversion", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 77 - } - }, - "context": { - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 79 - }, - "end": { - "line": 8, - "column": 30, - "index": 109 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/conversion.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Data", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Data", - "kind": "module" - } - ], - "namespace": "Data" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Data" - }, - { - "title": "submodule", - "description": "String Functions", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 83 - } - }, - "context": { - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 85 - }, - "end": { - "line": 8, - "column": 30, - "index": 115 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/string_functions.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Data", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Data", - "kind": "module" - } - ], - "namespace": "Data" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "getItem" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sensitive data such as passwords or personal information\nshould not be stored in local storage." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 12, - "name": "storeItem" - }, - { - "title": "for", - "description": "p5", - "lineNumber": 13 - }, - { - "title": "param", - "description": null, - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "key" - }, - { - "title": "param", - "description": null, - "lineNumber": 15, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "Boolean" - }, - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "NameExpression", - "name": "p5.Vector" - } - ] - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 17 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 173 - }, - "end": { - "line": 57, - "column": 3, - "index": 1433 - } - }, - "context": { - "loc": { - "start": { - "line": 58, - "column": 0, - "index": 1434 - }, - "end": { - "line": 97, - "column": 2, - "index": 2477 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/local_storage.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "key", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 15, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "Boolean" - }, - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "NameExpression", - "name": "p5.Vector" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "storeItem", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "storeItem", - "kind": "function" - } - ], - "namespace": "storeItem" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the value of an item that was stored in local storage\nusing storeItem()" - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "getItem" - }, - { - "title": "for", - "description": "p5", - "lineNumber": 6 - }, - { - "title": "param", - "description": "name that you wish to use to store in local storage", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "key" - }, - { - "title": "return", - "description": "Value of stored item", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Boolean" - }, - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "NameExpression", - "name": "p5.Vector" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 99, - "column": 0, - "index": 2479 - }, - "end": { - "line": 138, - "column": 3, - "index": 3503 - } - }, - "context": { - "loc": { - "start": { - "line": 139, - "column": 0, - "index": 3504 - }, - "end": { - "line": 171, - "column": 2, - "index": 4417 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/local_storage.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "key", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "name that you wish to use to store in local storage" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Value of stored item" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Boolean" - }, - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "NameExpression", - "name": "p5.Vector" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "getItem", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "getItem", - "kind": "function" - } - ], - "namespace": "getItem" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Clears all local storage items set with storeItem()\nfor the current domain." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "clearStorage" - }, - { - "title": "for", - "description": "p5", - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 173, - "column": 0, - "index": 4419 - }, - "end": { - "line": 196, - "column": 3, - "index": 5010 - } - }, - "context": { - "loc": { - "start": { - "line": 197, - "column": 0, - "index": 5011 - }, - "end": { - "line": 199, - "column": 2, - "index": 5078 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/local_storage.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "clearStorage", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "clearStorage", - "kind": "function" - } - ], - "namespace": "clearStorage" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes an item that was stored with storeItem()" - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "removeItem" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "key" - }, - { - "title": "for", - "description": "p5", - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 201, - "column": 0, - "index": 5080 - }, - "end": { - "line": 220, - "column": 3, - "index": 5489 - } - }, - "context": { - "loc": { - "start": { - "line": 221, - "column": 0, - "index": 5490 - }, - "end": { - "line": 229, - "column": 2, - "index": 5751 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/local_storage.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "key", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "removeItem", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "removeItem", - "kind": "function" - } - ], - "namespace": "removeItem" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a new instance of p5.StringDict using the key-value pair\nor the object you provide." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "createStringDict" - }, - { - "title": "for", - "description": "p5", - "lineNumber": 6 - }, - { - "title": "param", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "key" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "return", - "description": null, - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "p5.StringDict" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 14, - "column": 0, - "index": 287 - }, - "end": { - "line": 36, - "column": 3, - "index": 866 - } - }, - "context": { - "loc": { - "start": { - "line": 43, - "column": 0, - "index": 964 - }, - "end": { - "line": 46, - "column": 2, - "index": 1119 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "key", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.StringDict" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createStringDict", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createStringDict", - "kind": "function" - } - ], - "namespace": "createStringDict" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "createStringDict" - }, - { - "title": "param", - "description": "object", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Object" - }, - "name": "object" - }, - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.StringDict" - } - } - ], - "loc": { - "start": { - "line": 37, - "column": 0, - "index": 867 - }, - "end": { - "line": 41, - "column": 3, - "index": 962 - } - }, - "context": { - "loc": { - "start": { - "line": 43, - "column": 0, - "index": 964 - }, - "end": { - "line": 46, - "column": 2, - "index": 1119 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "object", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "object" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.StringDict" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createStringDict", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createStringDict", - "kind": "function" - } - ], - "namespace": "createStringDict" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a new instance of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.NumberDict" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " using the key-value pair\nor object you provide." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "createNumberDict" - }, - { - "title": "for", - "description": "p5", - "lineNumber": 6 - }, - { - "title": "param", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "key" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "value" - }, - { - "title": "return", - "description": null, - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "p5.NumberDict" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 48, - "column": 0, - "index": 1121 - }, - "end": { - "line": 70, - "column": 3, - "index": 1710 - } - }, - "context": { - "loc": { - "start": { - "line": 77, - "column": 0, - "index": 1808 - }, - "end": { - "line": 80, - "column": 2, - "index": 1963 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "key", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.NumberDict" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createNumberDict", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createNumberDict", - "kind": "function" - } - ], - "namespace": "createNumberDict" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "createNumberDict" - }, - { - "title": "param", - "description": "object", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Object" - }, - "name": "object" - }, - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.NumberDict" - } - } - ], - "loc": { - "start": { - "line": 71, - "column": 0, - "index": 1711 - }, - "end": { - "line": 75, - "column": 3, - "index": 1806 - } - }, - "context": { - "loc": { - "start": { - "line": 77, - "column": 0, - "index": 1808 - }, - "end": { - "line": 80, - "column": 2, - "index": 1963 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "object", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "object" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.NumberDict" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createNumberDict", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createNumberDict", - "kind": "function" - } - ], - "namespace": "createNumberDict" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Base class for all p5.Dictionary types. Specifically\ntyped Dictionary classes inherit from this class." - } - ] - } - ] - }, - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 5, - "type": null, - "name": "p5.TypedDict" - } - ], - "loc": { - "start": { - "line": 82, - "column": 0, - "index": 1965 - }, - "end": { - "line": 88, - "column": 3, - "index": 2110 - } - }, - "context": { - "loc": { - "start": { - "line": 89, - "column": 0, - "index": 2111 - }, - "end": { - "line": 375, - "column": 2, - "index": 9108 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "class", - "name": "p5.TypedDict", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.TypedDict", - "kind": "class" - } - ], - "namespace": "p5.TypedDict" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A simple Dictionary class for Strings." - } - ] - } - ] - }, - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 4, - "type": null, - "name": "p5.StringDict" - }, - { - "title": "extends", - "description": null, - "lineNumber": 5, - "type": null, - "name": "p5.TypedDict" - } - ], - "loc": { - "start": { - "line": 377, - "column": 0, - "index": 9110 - }, - "end": { - "line": 383, - "column": 3, - "index": 9214 - } - }, - "context": { - "loc": { - "start": { - "line": 384, - "column": 0, - "index": 9215 - }, - "end": { - "line": 392, - "column": 2, - "index": 9386 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [ - { - "title": "extends", - "description": null, - "lineNumber": 5, - "type": null, - "name": "p5.TypedDict" - } - ], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "class", - "name": "p5.StringDict", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.StringDict", - "kind": "class" - } - ], - "namespace": "p5.StringDict" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A simple Dictionary class for Numbers." - } - ] - } - ] - }, - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 4, - "type": null, - "name": "p5.NumberDict" - }, - { - "title": "extends", - "description": null, - "lineNumber": 5, - "type": null, - "name": "p5.TypedDict" - } - ], - "loc": { - "start": { - "line": 394, - "column": 0, - "index": 9388 - }, - "end": { - "line": 400, - "column": 3, - "index": 9492 - } - }, - "context": { - "loc": { - "start": { - "line": 402, - "column": 0, - "index": 9494 - }, - "end": { - "line": 626, - "column": 2, - "index": 15607 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/data/p5.TypedDict.js" - }, - "augments": [ - { - "title": "extends", - "description": null, - "lineNumber": 5, - "type": null, - "name": "p5.TypedDict" - } - ], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "class", - "name": "p5.NumberDict", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.NumberDict", - "kind": "class" - } - ], - "namespace": "p5.NumberDict" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Searches the page for the first element that matches the given\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "CSS selector string" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThe string can be an ID, class, tag name, or a combination. " - }, - { - "type": "inlineCode", - "value": "select()" - }, - { - "type": "text", - "value": "\nreturns a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object if it finds a match\nand " - }, - { - "type": "inlineCode", - "value": "null" - }, - { - "type": "text", - "value": " otherwise." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "container" - }, - { - "type": "text", - "value": ", is optional. It specifies a container to\nsearch within. container can be CSS selector string, a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, or an\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "HTMLElement" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 12, - "name": "select" - }, - { - "title": "param", - "description": "CSS selector string of element to search for.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "selectors" - }, - { - "title": "param", - "description": "CSS selector string, p5.Element, or\n HTMLElement to search within.", - "lineNumber": 14, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "p5.Element" - }, - { - "type": "NameExpression", - "name": "HTMLElement" - } - ] - } - }, - "name": "container" - }, - { - "title": "return", - "description": "p5.Element containing the element.", - "lineNumber": 16, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Element" - }, - { - "type": "NullLiteral" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 17 - } - ], - "loc": { - "start": { - "line": 21, - "column": 0, - "index": 778 - }, - "end": { - "line": 91, - "column": 3, - "index": 3114 - } - }, - "context": { - "loc": { - "start": { - "line": 92, - "column": 0, - "index": 3115 - }, - "end": { - "line": 101, - "column": 2, - "index": 3369 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "selectors", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "CSS selector string of element to search for." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "container", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "CSS selector string, " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "HTMLElement" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to search within." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "p5.Element" - }, - { - "type": "NameExpression", - "name": "HTMLElement" - } - ] - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " containing the element." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Element" - }, - { - "type": "NullLiteral" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "select", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "select", - "kind": "function" - } - ], - "namespace": "select" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Searches the page for all elements that matches the given\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "CSS selector string" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThe string can be an ID, class, tag name, or a combination. " - }, - { - "type": "inlineCode", - "value": "selectAll()" - }, - { - "type": "text", - "value": "\nreturns an array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " objects if it\nfinds any matches and an empty array otherwise." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "container" - }, - { - "type": "text", - "value": ", is optional. It specifies a container to\nsearch within. container can be CSS selector string, a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, or an\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "HTMLElement" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 12, - "name": "selectAll" - }, - { - "title": "param", - "description": "CSS selector string of element to search for.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "selectors" - }, - { - "title": "param", - "description": "CSS selector string, p5.Element, or\n HTMLElement to search within.", - "lineNumber": 14, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "p5.Element" - }, - { - "type": "NameExpression", - "name": "HTMLElement" - } - ] - } - }, - "name": "container" - }, - { - "title": "return", - "description": "array of p5.Elements containing any elements found.", - "lineNumber": 16, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.Element" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 17 - } - ], - "loc": { - "start": { - "line": 103, - "column": 0, - "index": 3371 - }, - "end": { - "line": 176, - "column": 3, - "index": 6042 - } - }, - "context": { - "loc": { - "start": { - "line": 177, - "column": 0, - "index": 6043 - }, - "end": { - "line": 189, - "column": 2, - "index": 6390 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "selectors", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "CSS selector string of element to search for." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "container", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "CSS selector string, " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "HTMLElement" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to search within." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "p5.Element" - }, - { - "type": "NameExpression", - "name": "HTMLElement" - } - ] - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "array of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "s containing any elements found." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.Element" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "selectAll", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "selectAll", - "kind": "function" - } - ], - "namespace": "selectAll" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes all elements created by p5.js, including any event handlers.\nThere are two exceptions:\ncanvas elements created by " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCanvas" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nand " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Render" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " objects created by\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createGraphics" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 7, - "name": "removeElements" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 240, - "column": 0, - "index": 7769 - }, - "end": { - "line": 300, - "column": 3, - "index": 9390 - } - }, - "context": { - "loc": { - "start": { - "line": 301, - "column": 0, - "index": 9391 - }, - "end": { - "line": 307, - "column": 2, - "index": 9760 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "removeElements", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "removeElements", - "kind": "function" - } - ], - "namespace": "removeElements" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "myElement.changed()" - }, - { - "type": "text", - "value": " sets a function to call when the value of the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object changes. Calling\n" - }, - { - "type": "inlineCode", - "value": "myElement.changed(false)" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "changed" - }, - { - "title": "param", - "description": "function to call when the element changes.\n `false` disables the function.", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - }, - "name": "fxn" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 309, - "column": 0, - "index": 9762 - }, - "end": { - "line": 365, - "column": 3, - "index": 11377 - } - }, - "context": { - "loc": { - "start": { - "line": 366, - "column": 0, - "index": 11378 - }, - "end": { - "line": 369, - "column": 2, - "index": 11494 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fxn", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call when the element changes.\n" - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "changed", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "changed", - "kind": "function" - } - ], - "namespace": "changed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "myElement.input()" - }, - { - "type": "text", - "value": " sets a function to call when input is detected within\nthe " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object. It's often used to with\ntext inputs and sliders. Calling " - }, - { - "type": "inlineCode", - "value": "myElement.input(false)" - }, - { - "type": "text", - "value": " disables the\nfunction." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "input" - }, - { - "title": "param", - "description": "function to call when input is detected within\n the element.\n `false` disables the function.", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - }, - "name": "fxn" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 371, - "column": 0, - "index": 11496 - }, - "end": { - "line": 425, - "column": 3, - "index": 13061 - } - }, - "context": { - "loc": { - "start": { - "line": 426, - "column": 0, - "index": 13062 - }, - "end": { - "line": 429, - "column": 2, - "index": 13175 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fxn", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call when input is detected within\nthe element.\n" - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " disables the function." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Function" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "input", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "input", - "kind": "function" - } - ], - "namespace": "input" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helpers for create methods." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 431, - "column": 0, - "index": 13177 - }, - "end": { - "line": 433, - "column": 3, - "index": 13215 - } - }, - "context": { - "loc": { - "start": { - "line": 434, - "column": 0, - "index": 13216 - }, - "end": { - "line": 442, - "column": 1, - "index": 13478 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "elt", - "lineNumber": 434 - }, - { - "title": "param", - "name": "pInst", - "lineNumber": 434 - }, - { - "title": "param", - "name": "media", - "lineNumber": 434 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "addElement", - "kind": "function", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "addElement", - "kind": "function" - } - ], - "namespace": "addElement" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a " - }, - { - "type": "inlineCode", - "value": "<div></div>" - }, - { - "type": "text", - "value": " element. It's commonly used as a\ncontainer for other elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The parameter " - }, - { - "type": "inlineCode", - "value": "html" - }, - { - "type": "text", - "value": " is optional. It accepts a string that sets the\ninner HTML of the new " - }, - { - "type": "inlineCode", - "value": "<div></div>" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 7, - "name": "createDiv" - }, - { - "title": "param", - "description": "inner HTML for the new `<div></div>` element.", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "html" - }, - { - "title": "return", - "description": "new p5.Element object.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 444, - "column": 0, - "index": 13480 - }, - "end": { - "line": 481, - "column": 3, - "index": 14437 - } - }, - "context": { - "loc": { - "start": { - "line": 482, - "column": 0, - "index": 14438 - }, - "end": { - "line": 486, - "column": 2, - "index": 14587 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "html", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "inner HTML for the new " - }, - { - "type": "inlineCode", - "value": "<div></div>" - }, - { - "type": "text", - "value": " element." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createDiv", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createDiv", - "kind": "function" - } - ], - "namespace": "createDiv" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a " - }, - { - "type": "inlineCode", - "value": "<p></p>" - }, - { - "type": "text", - "value": " element. It's commonly used for\nparagraph-length text." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The parameter " - }, - { - "type": "inlineCode", - "value": "html" - }, - { - "type": "text", - "value": " is optional. It accepts a string that sets the\ninner HTML of the new " - }, - { - "type": "inlineCode", - "value": "<p></p>" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 7, - "name": "createP" - }, - { - "title": "param", - "description": "inner HTML for the new `<p></p>` element.", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "html" - }, - { - "title": "return", - "description": "new p5.Element object.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 488, - "column": 0, - "index": 14589 - }, - "end": { - "line": 511, - "column": 3, - "index": 15249 - } - }, - "context": { - "loc": { - "start": { - "line": 512, - "column": 0, - "index": 15250 - }, - "end": { - "line": 516, - "column": 2, - "index": 15395 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "html", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "inner HTML for the new " - }, - { - "type": "inlineCode", - "value": "<p></p>" - }, - { - "type": "text", - "value": " element." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createP", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createP", - "kind": "function" - } - ], - "namespace": "createP" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a " - }, - { - "type": "inlineCode", - "value": "<span></span>" - }, - { - "type": "text", - "value": " element. It's commonly used as a\ncontainer for inline elements. For example, a " - }, - { - "type": "inlineCode", - "value": "<span></span>" - }, - { - "type": "text", - "value": "\ncan hold part of a sentence that's a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "different" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " style." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The parameter " - }, - { - "type": "inlineCode", - "value": "html" - }, - { - "type": "text", - "value": " is optional. It accepts a string that sets the\ninner HTML of the new " - }, - { - "type": "inlineCode", - "value": "<span></span>" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "createSpan" - }, - { - "title": "param", - "description": "inner HTML for the new `<span></span>` element.", - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "html" - }, - { - "title": "return", - "description": "new p5.Element object.", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 518, - "column": 0, - "index": 15397 - }, - "end": { - "line": 576, - "column": 3, - "index": 17003 - } - }, - "context": { - "loc": { - "start": { - "line": 577, - "column": 0, - "index": 17004 - }, - "end": { - "line": 581, - "column": 2, - "index": 17155 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "html", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "inner HTML for the new " - }, - { - "type": "inlineCode", - "value": "<span></span>" - }, - { - "type": "text", - "value": " element." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createSpan", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createSpan", - "kind": "function" - } - ], - "namespace": "createSpan" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates an " - }, - { - "type": "inlineCode", - "value": "<img>" - }, - { - "type": "text", - "value": " element that can appear outside of the canvas." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "src" - }, - { - "type": "text", - "value": ", is a string with the path to the image file.\n" - }, - { - "type": "inlineCode", - "value": "src" - }, - { - "type": "text", - "value": " should be a relative path, as in " - }, - { - "type": "inlineCode", - "value": "'assets/image.png'" - }, - { - "type": "text", - "value": ", or a URL, as\nin " - }, - { - "type": "inlineCode", - "value": "'https://example.com/image.png'" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "alt" - }, - { - "type": "text", - "value": ", is a string with the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "alternate text" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfor the image. An empty string " - }, - { - "type": "inlineCode", - "value": "''" - }, - { - "type": "text", - "value": " can be used for images that aren't displayed." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The third parameter, " - }, - { - "type": "inlineCode", - "value": "crossOrigin" - }, - { - "type": "text", - "value": ", is optional. It's a string that sets the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "crossOrigin property" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nof the image. Use " - }, - { - "type": "inlineCode", - "value": "'anonymous'" - }, - { - "type": "text", - "value": " or " - }, - { - "type": "inlineCode", - "value": "'use-credentials'" - }, - { - "type": "text", - "value": " to fetch the image\nwith cross-origin access." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The fourth parameter, " - }, - { - "type": "inlineCode", - "value": "callback" - }, - { - "type": "text", - "value": ", is also optional. It sets a function to\ncall after the image loads. The new image is passed to the callback\nfunction as a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 20, - "name": "createImg" - }, - { - "title": "param", - "description": "relative path or URL for the image.", - "lineNumber": 21, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "src" - }, - { - "title": "param", - "description": "alternate text for the image.", - "lineNumber": 22, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "alt" - }, - { - "title": "return", - "description": "new p5.Element object.", - "lineNumber": 23, - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 24 - } - ], - "loc": { - "start": { - "line": 583, - "column": 0, - "index": 17157 - }, - "end": { - "line": 623, - "column": 3, - "index": 18781 - } - }, - "context": { - "loc": { - "start": { - "line": 633, - "column": 0, - "index": 19235 - }, - "end": { - "line": 653, - "column": 2, - "index": 19887 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "src", - "lineNumber": 21, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "relative path or URL for the image." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "alt", - "lineNumber": 22, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "alternate text for the image." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createImg", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createImg", - "kind": "function" - } - ], - "namespace": "createImg" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "createImg" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "src" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "alt" - }, - { - "title": "param", - "description": "crossOrigin property to use when fetching the image.", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "crossOrigin" - }, - { - "title": "param", - "description": "function to call once the image loads. The new image will be passed\n to the function as a p5.Element object.", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Function" - } - }, - "name": "successCallback" - }, - { - "title": "return", - "description": "new p5.Element object.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "loc": { - "start": { - "line": 624, - "column": 0, - "index": 18782 - }, - "end": { - "line": 632, - "column": 3, - "index": 19234 - } - }, - "context": { - "loc": { - "start": { - "line": 633, - "column": 0, - "index": 19235 - }, - "end": { - "line": 653, - "column": 2, - "index": 19887 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "src", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "alt", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "crossOrigin", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "crossOrigin property to use when fetching the image." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - }, - { - "title": "param", - "name": "successCallback", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call once the image loads. The new image will be passed\nto the function as a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Function" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createImg", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createImg", - "kind": "function" - } - ], - "namespace": "createImg" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates an " - }, - { - "type": "inlineCode", - "value": "<a></a>" - }, - { - "type": "text", - "value": " element that links to another web page." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parmeter, " - }, - { - "type": "inlineCode", - "value": "href" - }, - { - "type": "text", - "value": ", is a string that sets the URL of the linked\npage." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "html" - }, - { - "type": "text", - "value": ", is a string that sets the inner HTML of the\nlink. It's common to use text, images, or buttons as links." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The third parameter, " - }, - { - "type": "inlineCode", - "value": "target" - }, - { - "type": "text", - "value": ", 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 " - }, - { - "type": "inlineCode", - "value": "'_blank'" - }, - { - "type": "text", - "value": " will cause the link to open in a new\nbrowser tab. MDN describes a few\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "other options" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 15, - "name": "createA" - }, - { - "title": "param", - "description": "URL of linked page.", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "href" - }, - { - "title": "param", - "description": "inner HTML of link element to display.", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "html" - }, - { - "title": "param", - "description": "target where the new link should open,\n either `'_blank'`, `'_self'`, `'_parent'`, or `'_top'`.", - "lineNumber": 18, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "target" - }, - { - "title": "return", - "description": "new p5.Element object.", - "lineNumber": 20, - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 21 - } - ], - "loc": { - "start": { - "line": 655, - "column": 0, - "index": 19889 - }, - "end": { - "line": 705, - "column": 3, - "index": 21622 - } - }, - "context": { - "loc": { - "start": { - "line": 706, - "column": 0, - "index": 21623 - }, - "end": { - "line": 713, - "column": 2, - "index": 21881 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "href", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "URL of linked page." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "html", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "inner HTML of link element to display." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "target", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "target where the new link should open,\neither " - }, - { - "type": "inlineCode", - "value": "'_blank'" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "'_self'" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "'_parent'" - }, - { - "type": "text", - "value": ", or " - }, - { - "type": "inlineCode", - "value": "'_top'" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createA", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createA", - "kind": "function" - } - ], - "namespace": "createA" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a slider " - }, - { - "type": "inlineCode", - "value": "<input></input>" - }, - { - "type": "text", - "value": " element. Range sliders are\nuseful for quickly selecting numbers from a given range." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first two parameters, " - }, - { - "type": "inlineCode", - "value": "min" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "max" - }, - { - "type": "text", - "value": ", are numbers that set the\nslider's minimum and maximum." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The third parameter, " - }, - { - "type": "inlineCode", - "value": "value" - }, - { - "type": "text", - "value": ", is optional. It's a number that sets the\nslider's default value." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The fourth parameter, " - }, - { - "type": "inlineCode", - "value": "step" - }, - { - "type": "text", - "value": ", is also optional. It's a number that sets the\nspacing between each value in the slider's range. Setting " - }, - { - "type": "inlineCode", - "value": "step" - }, - { - "type": "text", - "value": " to 0\nallows the slider to move smoothly from " - }, - { - "type": "inlineCode", - "value": "min" - }, - { - "type": "text", - "value": " to " - }, - { - "type": "inlineCode", - "value": "max" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 14, - "name": "createSlider" - }, - { - "title": "param", - "description": "minimum value of the slider.", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "min" - }, - { - "title": "param", - "description": "maximum value of the slider.", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "max" - }, - { - "title": "param", - "description": "default value of the slider.", - "lineNumber": 17, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "value" - }, - { - "title": "param", - "description": "size for each step in the slider's range.", - "lineNumber": 18, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "step" - }, - { - "title": "return", - "description": "new p5.Element object.", - "lineNumber": 19, - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 20 - } - ], - "loc": { - "start": { - "line": 717, - "column": 0, - "index": 21898 - }, - "end": { - "line": 826, - "column": 3, - "index": 24952 - } - }, - "context": { - "loc": { - "start": { - "line": 827, - "column": 0, - "index": 24953 - }, - "end": { - "line": 840, - "column": 2, - "index": 25384 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "min", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "minimum value of the slider." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "max", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "maximum value of the slider." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "default value of the slider." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "step", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "size for each step in the slider's range." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createSlider", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createSlider", - "kind": "function" - } - ], - "namespace": "createSlider" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a " - }, - { - "type": "inlineCode", - "value": "<button></button>" - }, - { - "type": "text", - "value": " element." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "label" - }, - { - "type": "text", - "value": ", is a string that sets the label displayed on\nthe button." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "value" - }, - { - "type": "text", - "value": ", is optional. It's a string that sets the\nbutton's value. See\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "MDN" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfor more details." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 11, - "name": "createButton" - }, - { - "title": "param", - "description": "label displayed on the button.", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "label" - }, - { - "title": "param", - "description": "value of the button.", - "lineNumber": 13, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "value" - }, - { - "title": "return", - "description": "new p5.Element object.", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 15 - } - ], - "loc": { - "start": { - "line": 842, - "column": 0, - "index": 25386 - }, - "end": { - "line": 905, - "column": 3, - "index": 27227 - } - }, - "context": { - "loc": { - "start": { - "line": 906, - "column": 0, - "index": 27228 - }, - "end": { - "line": 912, - "column": 2, - "index": 27474 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "label", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "label displayed on the button." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value of the button." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createButton", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createButton", - "kind": "function" - } - ], - "namespace": "createButton" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a checkbox " - }, - { - "type": "inlineCode", - "value": "<input></input>" - }, - { - "type": "text", - "value": " element. Checkboxes extend\nthe " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " class with a " - }, - { - "type": "inlineCode", - "value": "checked()" - }, - { - "type": "text", - "value": " method.\nCalling " - }, - { - "type": "inlineCode", - "value": "myBox.checked()" - }, - { - "type": "text", - "value": " returns " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": " if it the box is checked and\n" - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " otherwise." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "label" - }, - { - "type": "text", - "value": ", is optional. It's a string that sets the label\nto display next to the checkbox." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "value" - }, - { - "type": "text", - "value": ", is also optional. It's a boolean that sets the\ncheckbox's value." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 12, - "name": "createCheckbox" - }, - { - "title": "param", - "description": "label displayed after the checkbox.", - "lineNumber": 13, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "label" - }, - { - "title": "param", - "description": "value of the checkbox. Checked is `true` and unchecked is `false`.", - "lineNumber": 14, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "boolean" - } - }, - "name": "value" - }, - { - "title": "return", - "description": "new p5.Element object.", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 16 - } - ], - "loc": { - "start": { - "line": 914, - "column": 0, - "index": 27476 - }, - "end": { - "line": 1001, - "column": 3, - "index": 29909 - } - }, - "context": { - "loc": { - "start": { - "line": 1002, - "column": 0, - "index": 29910 - }, - "end": { - "line": 1055, - "column": 2, - "index": 31278 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "label", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "label displayed after the checkbox." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value of the checkbox. Checked is " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": " and unchecked is " - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "boolean" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createCheckbox", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createCheckbox", - "kind": "function" - } - ], - "namespace": "createCheckbox" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a dropdown menu " - }, - { - "type": "inlineCode", - "value": "<select></select>" - }, - { - "type": "text", - "value": " element." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The parameter is optional. If " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": " is passed, as in\n" - }, - { - "type": "inlineCode", - "value": "let mySelect = createSelect(true)" - }, - { - "type": "text", - "value": ", then the dropdown will support\nmultiple selections. If an existing " - }, - { - "type": "inlineCode", - "value": "<select></select>" - }, - { - "type": "text", - "value": " element\nis passed, as in " - }, - { - "type": "inlineCode", - "value": "let mySelect = createSelect(otherSelect)" - }, - { - "type": "text", - "value": ", the existing\nelement will be wrapped in a new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nobject." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Dropdowns extend the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " class with a few\nhelpful methods for managing options:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "mySelect.option(name, [value])" - }, - { - "type": "text", - "value": " adds an option to the menu. The first paremeter, " - }, - { - "type": "inlineCode", - "value": "name" - }, - { - "type": "text", - "value": ", is a string that sets the option's name and value. The second parameter, " - }, - { - "type": "inlineCode", - "value": "value" - }, - { - "type": "text", - "value": ", is optional. If provided, it sets the value that corresponds to the key " - }, - { - "type": "inlineCode", - "value": "name" - }, - { - "type": "text", - "value": ". If an option with " - }, - { - "type": "inlineCode", - "value": "name" - }, - { - "type": "text", - "value": " already exists, its value is changed to " - }, - { - "type": "inlineCode", - "value": "value" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "mySelect.value()" - }, - { - "type": "text", - "value": " returns the currently-selected option's value." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "mySelect.selected()" - }, - { - "type": "text", - "value": " returns the currently-selected option." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "mySelect.selected(option)" - }, - { - "type": "text", - "value": " selects the given option by default." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "mySelect.disable()" - }, - { - "type": "text", - "value": " marks the whole dropdown element as disabled." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "mySelect.disable(option)" - }, - { - "type": "text", - "value": " marks a given option as disabled." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "mySelect.enable()" - }, - { - "type": "text", - "value": " marks the whole dropdown element as enabled." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "mySelect.enable(option)" - }, - { - "type": "text", - "value": " marks a given option as enabled." - } - ] - } - ] - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 21, - "name": "createSelect" - }, - { - "title": "param", - "description": "support multiple selections.", - "lineNumber": 22, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "boolean" - } - }, - "name": "multiple" - }, - { - "title": "return", - "description": "new p5.Element object.", - "lineNumber": 23, - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 24 - } - ], - "loc": { - "start": { - "line": 1057, - "column": 0, - "index": 31280 - }, - "end": { - "line": 1206, - "column": 3, - "index": 35968 - } - }, - "context": { - "loc": { - "start": { - "line": 1214, - "column": 0, - "index": 36277 - }, - "end": { - "line": 1321, - "column": 2, - "index": 39266 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "multiple", - "lineNumber": 22, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "support multiple selections." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "boolean" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createSelect", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createSelect", - "kind": "function" - } - ], - "namespace": "createSelect" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "createSelect" - }, - { - "title": "param", - "description": "select element to wrap, either as a p5.Element or\n a HTMLSelectElement.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Object" - }, - "name": "existing" - }, - { - "title": "return", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "loc": { - "start": { - "line": 1207, - "column": 0, - "index": 35969 - }, - "end": { - "line": 1212, - "column": 3, - "index": 36275 - } - }, - "context": { - "loc": { - "start": { - "line": 1214, - "column": 0, - "index": 36277 - }, - "end": { - "line": 1321, - "column": 2, - "index": 39266 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "existing", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "select element to wrap, either as a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\na " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "HTMLSelectElement" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createSelect", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createSelect", - "kind": "function" - } - ], - "namespace": "createSelect" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a radio button element." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The parameter is optional. If a string is passed, as in\n" - }, - { - "type": "inlineCode", - "value": "let myRadio = createSelect('food')" - }, - { - "type": "text", - "value": ", then each radio option will\nhave " - }, - { - "type": "inlineCode", - "value": "\"food\"" - }, - { - "type": "text", - "value": " as its " - }, - { - "type": "inlineCode", - "value": "name" - }, - { - "type": "text", - "value": " parameter: " - }, - { - "type": "inlineCode", - "value": "<input name=\"food\"></input>" - }, - { - "type": "text", - "value": ".\nIf an existing " - }, - { - "type": "inlineCode", - "value": "<div></div>" - }, - { - "type": "text", - "value": " or " - }, - { - "type": "inlineCode", - "value": "<span></span>" - }, - { - "type": "text", - "value": "\nelement is passed, as in " - }, - { - "type": "inlineCode", - "value": "let myRadio = createSelect(container)" - }, - { - "type": "text", - "value": ", it will\nbecome the radio button's parent element." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Radio buttons extend the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " class with a few\nhelpful methods for managing options:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "myRadio.option(value, [label])" - }, - { - "type": "text", - "value": " adds an option to the menu. The first paremeter, " - }, - { - "type": "inlineCode", - "value": "value" - }, - { - "type": "text", - "value": ", is a string that sets the option's value and label. The second parameter, " - }, - { - "type": "inlineCode", - "value": "label" - }, - { - "type": "text", - "value": ", is optional. If provided, it sets the label displayed for the " - }, - { - "type": "inlineCode", - "value": "value" - }, - { - "type": "text", - "value": ". If an option with " - }, - { - "type": "inlineCode", - "value": "value" - }, - { - "type": "text", - "value": " already exists, its label is changed and its value is returned." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "myRadio.value()" - }, - { - "type": "text", - "value": " returns the currently-selected option's value." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "myRadio.selected()" - }, - { - "type": "text", - "value": " returns the currently-selected option." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "myRadio.selected(value)" - }, - { - "type": "text", - "value": " selects the given option and returns it as an " - }, - { - "type": "html", - "value": "" - }, - { - "type": "inlineCode", - "value": "HTMLInputElement" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "myRadio.disable(shouldDisable)" - }, - { - "type": "text", - "value": " enables the entire radio button if " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": " is passed and disables it if " - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " is passed." - } - ] - } - ] - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 18, - "name": "createRadio" - }, - { - "title": "param", - "description": "container HTML Element, either a `<div></div>`\nor `<span></span>`.", - "lineNumber": 19, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - }, - "name": "containerElement" - }, - { - "title": "return", - "description": "new p5.Element object.", - "lineNumber": 21, - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 1323, - "column": 0, - "index": 39268 - }, - "end": { - "line": 1446, - "column": 3, - "index": 43525 - } - }, - "context": { - "loc": { - "start": { - "line": 1456, - "column": 0, - "index": 43842 - }, - "end": { - "line": 1612, - "column": 2, - "index": 48548 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "containerElement", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "container HTML Element, either a " - }, - { - "type": "inlineCode", - "value": "<div></div>" - }, - { - "type": "text", - "value": "\nor " - }, - { - "type": "inlineCode", - "value": "<span></span>" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createRadio", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createRadio", - "kind": "function" - } - ], - "namespace": "createRadio" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "createRadio" - }, - { - "title": "param", - "description": "name parameter assigned to each option's `<input></input>` element.", - "lineNumber": 2, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "name" - }, - { - "title": "return", - "description": "new p5.Element object.", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "loc": { - "start": { - "line": 1447, - "column": 0, - "index": 43526 - }, - "end": { - "line": 1451, - "column": 3, - "index": 43736 - } - }, - "context": { - "loc": { - "start": { - "line": 1456, - "column": 0, - "index": 43842 - }, - "end": { - "line": 1612, - "column": 2, - "index": 48548 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "name", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "name parameter assigned to each option's " - }, - { - "type": "inlineCode", - "value": "<input></input>" - }, - { - "type": "text", - "value": " element." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createRadio", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createRadio", - "kind": "function" - } - ], - "namespace": "createRadio" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "createRadio" - }, - { - "title": "return", - "description": "new p5.Element object.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "loc": { - "start": { - "line": 1452, - "column": 0, - "index": 43737 - }, - "end": { - "line": 1455, - "column": 3, - "index": 43841 - } - }, - "context": { - "loc": { - "start": { - "line": 1456, - "column": 0, - "index": 43842 - }, - "end": { - "line": 1612, - "column": 2, - "index": 48548 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createRadio", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createRadio", - "kind": "function" - } - ], - "namespace": "createRadio" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a color picker element." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The parameter, " - }, - { - "type": "inlineCode", - "value": "value" - }, - { - "type": "text", - "value": ", is optional. If a color string or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object is passed, it will set the default\ncolor." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Color pickers extend the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " class with a\ncouple of helpful methods for managing colors:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "myPicker.value()" - }, - { - "type": "text", - "value": " returns the current color as a hex string in the format " - }, - { - "type": "inlineCode", - "value": "'#rrggbb'" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "myPicker.color()" - }, - { - "type": "text", - "value": " returns the current color as a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 13, - "name": "createColorPicker" - }, - { - "title": "param", - "description": "default color as a CSS color string.", - "lineNumber": 14, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "p5.Color" - } - ] - } - }, - "name": "value" - }, - { - "title": "return", - "description": "new p5.Element object.", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 16 - } - ], - "loc": { - "start": { - "line": 1614, - "column": 0, - "index": 48550 - }, - "end": { - "line": 1671, - "column": 3, - "index": 50309 - } - }, - "context": { - "loc": { - "start": { - "line": 1672, - "column": 0, - "index": 50310 - }, - "end": { - "line": 1706, - "column": 2, - "index": 51280 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "default color as a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "CSS color string" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "p5.Color" - } - ] - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createColorPicker", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createColorPicker", - "kind": "function" - } - ], - "namespace": "createColorPicker" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a text " - }, - { - "type": "inlineCode", - "value": "<input></input>" - }, - { - "type": "text", - "value": " element. Call " - }, - { - "type": "inlineCode", - "value": "myInput.size()" - }, - { - "type": "text", - "value": "\nto set the length of the text box." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "value" - }, - { - "type": "text", - "value": ", is optional. It's a string that sets the\ninput's default value. The input is blank by default." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "type" - }, - { - "type": "text", - "value": ", is also optional. It's a string that\nspecifies the type of text being input. See MDN for a full\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "list of options" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThe default is " - }, - { - "type": "inlineCode", - "value": "'text'" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 12, - "name": "createInput" - }, - { - "title": "param", - "description": "default value of the input box. Defaults to an empty string `''`.", - "lineNumber": 13, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "value" - }, - { - "title": "param", - "description": "type of input. Defaults to `'text'`.", - "lineNumber": 14, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "type" - }, - { - "title": "return", - "description": "new p5.Element object.", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 16 - } - ], - "loc": { - "start": { - "line": 1708, - "column": 0, - "index": 51282 - }, - "end": { - "line": 1771, - "column": 3, - "index": 53244 - } - }, - "context": { - "loc": { - "start": { - "line": 1777, - "column": 0, - "index": 53327 - }, - "end": { - "line": 1783, - "column": 2, - "index": 53594 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "default value of the input box. Defaults to an empty string " - }, - { - "type": "inlineCode", - "value": "''" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - }, - { - "title": "param", - "name": "type", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "type of input. Defaults to " - }, - { - "type": "inlineCode", - "value": "'text'" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createInput", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createInput", - "kind": "function" - } - ], - "namespace": "createInput" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "createInput" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "value" - }, - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "loc": { - "start": { - "line": 1772, - "column": 0, - "index": 53245 - }, - "end": { - "line": 1776, - "column": 3, - "index": 53326 - } - }, - "context": { - "loc": { - "start": { - "line": 1777, - "column": 0, - "index": 53327 - }, - "end": { - "line": 1783, - "column": 2, - "index": 53594 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 2, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createInput", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createInput", - "kind": "function" - } - ], - "namespace": "createInput" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates an " - }, - { - "type": "inlineCode", - "value": "<input></input>" - }, - { - "type": "text", - "value": " element of type " - }, - { - "type": "inlineCode", - "value": "'file'" - }, - { - "type": "text", - "value": ".\nThis allows users to select local files for use in a sketch." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "callback" - }, - { - "type": "text", - "value": ", is a function that's called when the file\nloads. The callback function should have one parameter, " - }, - { - "type": "inlineCode", - "value": "file" - }, - { - "type": "text", - "value": ", that's a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.File" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "multiple" - }, - { - "type": "text", - "value": ", is optional. It's a boolean value that\nallows loading multiple files if set to " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": ". If " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "callback" - }, - { - "type": "text", - "value": "\nwill be called once per file." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 12, - "name": "createFileInput" - }, - { - "title": "param", - "description": "function to call once the file loads.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Function" - }, - "name": "callback" - }, - { - "title": "param", - "description": "allow multiple files to be selected.", - "lineNumber": 14, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - }, - "name": "multiple" - }, - { - "title": "return", - "description": "new p5.Element object.", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 16 - } - ], - "loc": { - "start": { - "line": 1785, - "column": 0, - "index": 53596 - }, - "end": { - "line": 1878, - "column": 3, - "index": 56241 - } - }, - "context": { - "loc": { - "start": { - "line": 1879, - "column": 0, - "index": 56242 - }, - "end": { - "line": 1901, - "column": 2, - "index": 57024 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "callback", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call once the file loads." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Function" - } - }, - { - "title": "param", - "name": "multiple", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "allow multiple files to be selected." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createFileInput", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createFileInput", - "kind": "function" - } - ], - "namespace": "createFileInput" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "VIDEO STUFF *" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 1903, - "column": 0, - "index": 57026 - }, - "end": { - "line": 1903, - "column": 19, - "index": 57045 - } - }, - "context": { - "loc": { - "start": { - "line": 1906, - "column": 0, - "index": 57105 - }, - "end": { - "line": 1948, - "column": 1, - "index": 58415 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "pInst", - "lineNumber": 1906 - }, - { - "title": "param", - "name": "type", - "lineNumber": 1906 - }, - { - "title": "param", - "name": "src", - "lineNumber": 1906 - }, - { - "title": "param", - "name": "callback", - "lineNumber": 1906 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "createMedia", - "kind": "function", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createMedia", - "kind": "function" - } - ], - "namespace": "createMedia" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a " - }, - { - "type": "inlineCode", - "value": "<video>" - }, - { - "type": "text", - "value": " element for simple audio/video playback.\nReturns a new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.MediaElement" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Videos are shown by default. They can be hidden by calling " - }, - { - "type": "inlineCode", - "value": "video.hide()" - }, - { - "type": "text", - "value": "\nand drawn to the canvas using " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "image()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "src" - }, - { - "type": "text", - "value": ", is the path the video. If a single string is\npassed, as in " - }, - { - "type": "inlineCode", - "value": "'assets/topsecret.mp4'" - }, - { - "type": "text", - "value": ", a single video is loaded. An array\nof strings can be used to load the same video in different formats. For\nexample, " - }, - { - "type": "inlineCode", - "value": "['assets/topsecret.mp4', 'assets/topsecret.ogv', 'assets/topsecret.webm']" - }, - { - "type": "text", - "value": ".\nThis is useful for ensuring that the video can play across different browsers with\ndifferent capabilities. See\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "MDN" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfor more information about supported formats." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "callback" - }, - { - "type": "text", - "value": ", is optional. It's a function to call once\nthe video is ready to play." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 19, - "name": "createVideo" - }, - { - "title": "param", - "description": "path to a video file, or an array of paths for\n supporting different browsers.", - "lineNumber": 20, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - ] - }, - "name": "src" - }, - { - "title": "param", - "description": "function to call once the video is ready to play.", - "lineNumber": 22, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Function" - } - }, - "name": "callback" - }, - { - "title": "return", - "description": "new p5.MediaElement object.", - "lineNumber": 23, - "type": { - "type": "NameExpression", - "name": "p5.MediaElement" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 24 - } - ], - "loc": { - "start": { - "line": 1950, - "column": 0, - "index": 58417 - }, - "end": { - "line": 2035, - "column": 3, - "index": 61254 - } - }, - "context": { - "loc": { - "start": { - "line": 2036, - "column": 0, - "index": 61255 - }, - "end": { - "line": 2039, - "column": 2, - "index": 61415 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "src", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "path to a video file, or an array of paths for\nsupporting different browsers." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - ] - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 22, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call once the video is ready to play." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Function" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.MediaElement" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.MediaElement" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createVideo", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createVideo", - "kind": "function" - } - ], - "namespace": "createVideo" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a hidden " - }, - { - "type": "inlineCode", - "value": "<audio>" - }, - { - "type": "text", - "value": " element for simple audio playback.\nReturns a new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.MediaElement" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "src" - }, - { - "type": "text", - "value": ", is the path the video. If a single string is\npassed, as in " - }, - { - "type": "inlineCode", - "value": "'assets/video.mp4'" - }, - { - "type": "text", - "value": ", a single video is loaded. An array\nof strings can be used to load the same video in different formats. For\nexample, " - }, - { - "type": "inlineCode", - "value": "['assets/video.mp4', 'assets/video.ogv', 'assets/video.webm']" - }, - { - "type": "text", - "value": ".\nThis is useful for ensuring that the video can play across different\nbrowsers with different capabilities. See\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "MDN" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfor more information about supported formats." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "callback" - }, - { - "type": "text", - "value": ", is optional. It's a function to call once\nthe audio is ready to play." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 16, - "name": "createAudio" - }, - { - "title": "param", - "description": "path to an audio file, or an array of paths\n for supporting different browsers.", - "lineNumber": 17, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - ] - } - }, - "name": "src" - }, - { - "title": "param", - "description": "function to call once the audio is ready to play.", - "lineNumber": 19, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Function" - } - }, - "name": "callback" - }, - { - "title": "return", - "description": "new p5.MediaElement object.", - "lineNumber": 20, - "type": { - "type": "NameExpression", - "name": "p5.MediaElement" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 21 - } - ], - "loc": { - "start": { - "line": 2043, - "column": 0, - "index": 61438 - }, - "end": { - "line": 2079, - "column": 3, - "index": 62974 - } - }, - "context": { - "loc": { - "start": { - "line": 2080, - "column": 0, - "index": 62975 - }, - "end": { - "line": 2083, - "column": 2, - "index": 63135 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "src", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "path to an audio file, or an array of paths\nfor supporting different browsers." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - ] - } - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call once the audio is ready to play." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Function" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.MediaElement" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.MediaElement" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createAudio", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createAudio", - "kind": "function" - } - ], - "namespace": "createAudio" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a " - }, - { - "type": "inlineCode", - "value": "<video>" - }, - { - "type": "text", - "value": " element that \"captures\" the audio/video stream from\nthe webcam and microphone. Returns a new\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Videos are shown by default. They can be hidden by calling " - }, - { - "type": "inlineCode", - "value": "capture.hide()" - }, - { - "type": "text", - "value": "\nand drawn to the canvas using " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "image()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "type" - }, - { - "type": "text", - "value": ", is optional. It sets the type of capture to\nuse. By default, " - }, - { - "type": "inlineCode", - "value": "createCapture()" - }, - { - "type": "text", - "value": " captures both audio and video. If " - }, - { - "type": "inlineCode", - "value": "VIDEO" - }, - { - "type": "text", - "value": "\nis passed, as in " - }, - { - "type": "inlineCode", - "value": "createCapture(VIDEO)" - }, - { - "type": "text", - "value": ", only video will be captured.\nIf " - }, - { - "type": "inlineCode", - "value": "AUDIO" - }, - { - "type": "text", - "value": " is passed, as in " - }, - { - "type": "inlineCode", - "value": "createCapture(AUDIO)" - }, - { - "type": "text", - "value": ", only audio will be\ncaptured. A constraints object can also be passed to customize the stream.\nSee the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nW3C documentation" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for possible properties. Different browsers support different\nproperties." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "callback" - }, - { - "type": "text", - "value": ", is optional. It's a function to call once\nthe capture is ready for use. The callback function should have one\nparameter, " - }, - { - "type": "inlineCode", - "value": "stream" - }, - { - "type": "text", - "value": ", that's a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "MediaStream" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: " - }, - { - "type": "inlineCode", - "value": "createCapture()" - }, - { - "type": "text", - "value": " only works when running a sketch locally or using HTTPS. Learn more\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "here" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nand " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "here" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 26, - "name": "createCapture" - }, - { - "title": "param", - "description": "type of capture, either AUDIO or VIDEO,\n or a constraints object. Both video and audio\n audio streams are captured by default.", - "lineNumber": 27, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "AUDIO" - }, - { - "type": "NameExpression", - "name": "VIDEO" - }, - { - "type": "NameExpression", - "name": "Object" - } - ] - } - }, - "name": "type" - }, - { - "title": "param", - "description": "function to call once the stream\n has loaded.", - "lineNumber": 30, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Function" - } - }, - "name": "callback" - }, - { - "title": "return", - "description": "new p5.Element object.", - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 33 - } - ], - "loc": { - "start": { - "line": 2121, - "column": 0, - "index": 64443 - }, - "end": { - "line": 2211, - "column": 3, - "index": 67686 - } - }, - "context": { - "loc": { - "start": { - "line": 2212, - "column": 0, - "index": 67687 - }, - "end": { - "line": 2265, - "column": 2, - "index": 69460 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "type", - "lineNumber": 27, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "type of capture, either AUDIO or VIDEO,\nor a constraints object. Both video and audio\naudio streams are captured by default." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "AUDIO" - }, - { - "type": "NameExpression", - "name": "VIDEO" - }, - { - "type": "NameExpression", - "name": "Object" - } - ] - } - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 30, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call once the stream\nhas loaded." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Function" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createCapture", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createCapture", - "kind": "function" - } - ], - "namespace": "createCapture" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "tag" - }, - { - "type": "text", - "value": ", is a string an HTML tag such as " - }, - { - "type": "inlineCode", - "value": "'h5'" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "content" - }, - { - "type": "text", - "value": ", is optional. It's a string that sets the\nHTML content to insert into the new element. New elements have no content\nby default." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "createElement" - }, - { - "title": "param", - "description": "tag for the new element.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "tag" - }, - { - "title": "param", - "description": "HTML content to insert into the element.", - "lineNumber": 11, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "content" - }, - { - "title": "return", - "description": "new p5.Element object.", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 2267, - "column": 0, - "index": 69462 - }, - "end": { - "line": 2310, - "column": 3, - "index": 70611 - } - }, - "context": { - "loc": { - "start": { - "line": 2311, - "column": 0, - "index": 70612 - }, - "end": { - "line": 2318, - "column": 2, - "index": 70871 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "tag", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "tag for the new element." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "content", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "HTML content to insert into the element." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Element" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createElement", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createElement", - "kind": "function" - } - ], - "namespace": "createElement" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Adds specified class to the element." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.Element", - "lineNumber": 4 - }, - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "addClass" - }, - { - "title": "param", - "description": "name of class to add", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "class" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 7 - }, - { - "title": "example", - "description": "
\nlet div = createDiv('div');\ndiv.addClass('myClass');\n
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 2323, - "column": 0, - "index": 71083 - }, - "end": { - "line": 2336, - "column": 3, - "index": 71356 - } - }, - "context": { - "loc": { - "start": { - "line": 2337, - "column": 0, - "index": 71357 - }, - "end": { - "line": 2346, - "column": 2, - "index": 71584 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nlet div = createDiv('div');\ndiv.addClass('myClass');\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "class", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "name of class to add" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "addClass", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "addClass", - "kind": "function" - } - ], - "namespace": "addClass" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes specified class from the element." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "removeClass" - }, - { - "title": "param", - "description": "name of class to remove", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "class" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 2348, - "column": 0, - "index": 71586 - }, - "end": { - "line": 2372, - "column": 3, - "index": 72144 - } - }, - "context": { - "loc": { - "start": { - "line": 2373, - "column": 0, - "index": 72145 - }, - "end": { - "line": 2377, - "column": 2, - "index": 72343 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "class", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "name of class to remove" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "removeClass", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "removeClass", - "kind": "function" - } - ], - "namespace": "removeClass" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Checks if specified class is already applied to element." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "hasClass" - }, - { - "title": "returns", - "description": "a boolean value if element has specified class", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "boolean" - } - }, - { - "title": "param", - "description": "{String} class name of class to check", - "lineNumber": 6, - "type": null, - "name": "c" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 2379, - "column": 0, - "index": 72345 - }, - "end": { - "line": 2403, - "column": 3, - "index": 72868 - } - }, - "context": { - "loc": { - "start": { - "line": 2404, - "column": 0, - "index": 72869 - }, - "end": { - "line": 2406, - "column": 2, - "index": 72959 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "c", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "{String} class name of class to check" - } - ] - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a boolean value if element has specified class" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "boolean" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "hasClass", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "hasClass", - "kind": "function" - } - ], - "namespace": "hasClass" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Toggles element class." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "toggleClass" - }, - { - "title": "param", - "description": "{String} class name to toggle", - "lineNumber": 5, - "type": null, - "name": "c" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\nlet div;\n\nfunction setup() {\n div = createDiv('div');\n div.addClass('show');\n}\n\nfunction mousePressed() {\n div.toggleClass('show');\n}\n
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 2408, - "column": 0, - "index": 72961 - }, - "end": { - "line": 2428, - "column": 3, - "index": 73305 - } - }, - "context": { - "loc": { - "start": { - "line": 2429, - "column": 0, - "index": 73306 - }, - "end": { - "line": 2439, - "column": 2, - "index": 73678 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nlet div;\n\nfunction setup() {\n div = createDiv('div');\n div.addClass('show');\n}\n\nfunction mousePressed() {\n div.toggleClass('show');\n}\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "c", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "{String} class name to toggle" - } - ] - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "toggleClass", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "toggleClass", - "kind": "function" - } - ], - "namespace": "toggleClass" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Attaches the element as a child to the parent specified.\nAccepts either a string ID, DOM node, or " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nIf no argument is specified, an array of children DOM nodes is returned." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "child" - }, - { - "title": "returns", - "description": "an array of child nodes", - "lineNumber": 7, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Node" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 2441, - "column": 0, - "index": 73680 - }, - "end": { - "line": 2468, - "column": 3, - "index": 74656 - } - }, - "context": { - "loc": { - "start": { - "line": 2475, - "column": 0, - "index": 74851 - }, - "end": { - "line": 2492, - "column": 2, - "index": 75336 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "an array of child nodes" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Node" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "child", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "child", - "kind": "function" - } - ], - "namespace": "child" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "child" - }, - { - "title": "param", - "description": "the ID, DOM node, or p5.Element\n to add to the current element", - "lineNumber": 2, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "p5.Element" - } - ] - } - }, - "name": "child" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 2469, - "column": 0, - "index": 74657 - }, - "end": { - "line": 2474, - "column": 3, - "index": 74850 - } - }, - "context": { - "loc": { - "start": { - "line": 2475, - "column": 0, - "index": 74851 - }, - "end": { - "line": 2492, - "column": 2, - "index": 75336 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "child", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the ID, DOM node, or " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nto add to the current element" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "p5.Element" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "child", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "child", - "kind": "function" - } - ], - "namespace": "child" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "center" - }, - { - "title": "param", - "description": "passing 'vertical', 'horizontal' aligns element accordingly", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "align" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\nfunction setup() {\n let div = createDiv('').size(10, 10);\n div.style('background-color', 'orange');\n div.center();\n}\n
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 2494, - "column": 0, - "index": 75338 - }, - "end": { - "line": 2512, - "column": 3, - "index": 75897 - } - }, - "context": { - "loc": { - "start": { - "line": 2513, - "column": 0, - "index": 75898 - }, - "end": { - "line": 2543, - "column": 2, - "index": 76952 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nfunction setup() {\n let div = createDiv('').size(10, 10);\n div.style('background-color', 'orange');\n div.center();\n}\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "align", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "passing 'vertical', 'horizontal' aligns element accordingly" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "center", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "center", - "kind": "function" - } - ], - "namespace": "center" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.Element", - "lineNumber": 8 - }, - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "html" - }, - { - "title": "returns", - "description": "the inner HTML of the element", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\nlet div = createDiv('').size(100, 100);\ndiv.html('hi');\n
\n
\nlet div = createDiv('Hello ').size(100, 100);\ndiv.html('World', true);\n
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 2545, - "column": 0, - "index": 76954 - }, - "end": { - "line": 2565, - "column": 3, - "index": 77568 - } - }, - "context": { - "loc": { - "start": { - "line": 2572, - "column": 0, - "index": 77740 - }, - "end": { - "line": 2582, - "column": 2, - "index": 78010 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nlet div = createDiv('').size(100, 100);\ndiv.html('hi');\n
\n
\nlet div = createDiv('Hello ').size(100, 100);\ndiv.html('World', true);\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the inner HTML of the element" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "html", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "html", - "kind": "function" - } - ], - "namespace": "html" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "html" - }, - { - "title": "param", - "description": "the HTML to be placed inside the element", - "lineNumber": 2, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "html" - }, - { - "title": "param", - "description": "whether to append HTML to existing", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "boolean" - } - }, - "name": "append" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 2566, - "column": 0, - "index": 77569 - }, - "end": { - "line": 2571, - "column": 3, - "index": 77739 - } - }, - "context": { - "loc": { - "start": { - "line": 2572, - "column": 0, - "index": 77740 - }, - "end": { - "line": 2582, - "column": 2, - "index": 78010 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "html", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the HTML to be placed inside the element" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - }, - { - "title": "param", - "name": "append", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "whether to append HTML to existing" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "boolean" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "html", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "html", - "kind": "function" - } - ], - "namespace": "html" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "positioning scheme" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nIf no arguments given, the function returns the x and y position of the element." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "found documentation on how to be more specific with object type\n" - }, - { - "type": "link", - "title": null, - "url": "https://stackoverflow.com/questions/14714314/how-do-i-comment-object-literals-in-yuidoc", - "children": [ - { - "type": "text", - "value": "https://stackoverflow.com/questions/14714314/how-do-i-comment-object-literals-in-yuidoc" - } - ] - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 13, - "name": "position" - }, - { - "title": "returns", - "description": "object of form { x: 0, y: 0 } containing the position of the element in an object", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 15 - } - ], - "loc": { - "start": { - "line": 2584, - "column": 0, - "index": 78012 - }, - "end": { - "line": 2616, - "column": 3, - "index": 79348 - } - }, - "context": { - "loc": { - "start": { - "line": 2624, - "column": 0, - "index": 79657 - }, - "end": { - "line": 2646, - "column": 2, - "index": 80271 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "object of form { x: 0, y: 0 } containing the position of the element in an object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "position", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "position", - "kind": "function" - } - ], - "namespace": "position" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "position" - }, - { - "title": "param", - "description": "x-position relative to upper left of window (optional)", - "lineNumber": 2, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "x" - }, - { - "title": "param", - "description": "y-position relative to upper left of window (optional)", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "y" - }, - { - "title": "param", - "description": "it can be static, fixed, relative, sticky, initial or inherit (optional)", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "positionType" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 2617, - "column": 0, - "index": 79349 - }, - "end": { - "line": 2623, - "column": 3, - "index": 79656 - } - }, - "context": { - "loc": { - "start": { - "line": 2624, - "column": 0, - "index": 79657 - }, - "end": { - "line": 2646, - "column": 2, - "index": 80271 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-position relative to upper left of window (optional)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-position relative to upper left of window (optional)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "positionType", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "it can be static, fixed, relative, sticky, initial or inherit (optional)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "position", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "position", - "kind": "function" - } - ], - "namespace": "position" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Applies a style to an element by adding a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "CSS declaration" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "property" - }, - { - "type": "text", - "value": ", is a string. If the name of a style\nproperty is passed, as in " - }, - { - "type": "inlineCode", - "value": "myElement.style('color')" - }, - { - "type": "text", - "value": ", the method returns\nthe current value as a string or " - }, - { - "type": "inlineCode", - "value": "null" - }, - { - "type": "text", - "value": " if it hasn't been set. If a\n" - }, - { - "type": "inlineCode", - "value": "property:style" - }, - { - "type": "text", - "value": " string is passed, as in\n" - }, - { - "type": "inlineCode", - "value": "myElement.style('color:deeppink')" - }, - { - "type": "text", - "value": ", the method sets " - }, - { - "type": "inlineCode", - "value": "property" - }, - { - "type": "text", - "value": " to\n" - }, - { - "type": "inlineCode", - "value": "value" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "value" - }, - { - "type": "text", - "value": ", is optional. It sets the property's value.\n" - }, - { - "type": "inlineCode", - "value": "value" - }, - { - "type": "text", - "value": " can be a string, as in\n" - }, - { - "type": "inlineCode", - "value": "myElement.style('color', 'deeppink')" - }, - { - "type": "text", - "value": ", or a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, as in\n" - }, - { - "type": "inlineCode", - "value": "myElement.style('color', myColor)" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 17, - "name": "style" - }, - { - "title": "param", - "description": "style property to set.", - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "property" - }, - { - "title": "returns", - "description": "value of the property.", - "lineNumber": 19, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 20 - } - ], - "loc": { - "start": { - "line": 2704, - "column": 0, - "index": 82125 - }, - "end": { - "line": 2801, - "column": 3, - "index": 84686 - } - }, - "context": { - "loc": { - "start": { - "line": 2809, - "column": 0, - "index": 84866 - }, - "end": { - "line": 2857, - "column": 2, - "index": 86143 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "property", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "style property to set." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value of the property." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "style", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "style", - "kind": "function" - } - ], - "namespace": "style" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "style" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "property" - }, - { - "title": "param", - "description": "value to assign to the property.", - "lineNumber": 3, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "p5.Color" - } - ] - }, - "name": "value" - }, - { - "title": "return", - "description": "value of the property.", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "chainable", - "description": null, - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 2802, - "column": 0, - "index": 84687 - }, - "end": { - "line": 2808, - "column": 3, - "index": 84865 - } - }, - "context": { - "loc": { - "start": { - "line": 2809, - "column": 0, - "index": 84866 - }, - "end": { - "line": 2857, - "column": 2, - "index": 86143 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "property", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign to the property." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "p5.Color" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value of the property." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "style", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "style", - "kind": "function" - } - ], - "namespace": "style" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Adds an\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "attribute" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nto the element. This method is useful for advanced tasks." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Most commonly-used attributes, such as " - }, - { - "type": "inlineCode", - "value": "id" - }, - { - "type": "text", - "value": ", can be set with their\ndedicated methods. For example, " - }, - { - "type": "inlineCode", - "value": "nextButton.id('next')" - }, - { - "type": "text", - "value": " sets an element's\n" - }, - { - "type": "inlineCode", - "value": "id" - }, - { - "type": "text", - "value": " attribute." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "attr" - }, - { - "type": "text", - "value": ", is the attribute's name as a string. Calling\n" - }, - { - "type": "inlineCode", - "value": "myElement.attribute('align')" - }, - { - "type": "text", - "value": " returns the attribute's current value as a\nstring or " - }, - { - "type": "inlineCode", - "value": "null" - }, - { - "type": "text", - "value": " if it hasn't been set." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "value" - }, - { - "type": "text", - "value": ", is optional. It's a string used to set the\nattribute's value. For example, calling\n" - }, - { - "type": "inlineCode", - "value": "myElement.attribute('align', 'center')" - }, - { - "type": "text", - "value": " sets the element's horizontal\nalignment to " - }, - { - "type": "inlineCode", - "value": "center" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 18, - "name": "attribute" - }, - { - "title": "return", - "description": "value of the attribute.", - "lineNumber": 19, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 21 - } - ], - "loc": { - "start": { - "line": 2859, - "column": 0, - "index": 86145 - }, - "end": { - "line": 2918, - "column": 3, - "index": 88072 - } - }, - "context": { - "loc": { - "start": { - "line": 2925, - "column": 0, - "index": 88230 - }, - "end": { - "line": 2946, - "column": 2, - "index": 88911 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value of the attribute." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "attribute", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "attribute", - "kind": "function" - } - ], - "namespace": "attribute" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "attribute" - }, - { - "title": "param", - "description": "attribute to set.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "attr" - }, - { - "title": "param", - "description": "value to assign to the attribute.", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 2919, - "column": 0, - "index": 88073 - }, - "end": { - "line": 2924, - "column": 3, - "index": 88229 - } - }, - "context": { - "loc": { - "start": { - "line": 2925, - "column": 0, - "index": 88230 - }, - "end": { - "line": 2946, - "column": 2, - "index": 88911 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "attr", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "attribute to set." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to assign to the attribute." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "attribute", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "attribute", - "kind": "function" - } - ], - "namespace": "attribute" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes an attribute from the element." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The parameter " - }, - { - "type": "inlineCode", - "value": "attr" - }, - { - "type": "text", - "value": " is the attribute's name as a string. For example,\ncalling " - }, - { - "type": "inlineCode", - "value": "myElement.removeAttribute('align')" - }, - { - "type": "text", - "value": " removes its " - }, - { - "type": "inlineCode", - "value": "align" - }, - { - "type": "text", - "value": "\nattribute if it's been set." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 7, - "name": "removeAttribute" - }, - { - "title": "param", - "description": "attribute to remove.", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "attr" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 2948, - "column": 0, - "index": 88913 - }, - "end": { - "line": 2982, - "column": 3, - "index": 89779 - } - }, - "context": { - "loc": { - "start": { - "line": 2983, - "column": 0, - "index": 89780 - }, - "end": { - "line": 2995, - "column": 2, - "index": 90149 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "attr", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "attribute to remove." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "removeAttribute", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "removeAttribute", - "kind": "function" - } - ], - "namespace": "removeAttribute" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns or sets the element's value." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "inlineCode", - "value": "myElement.value()" - }, - { - "type": "text", - "value": " returns the element's current value." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The parameter, " - }, - { - "type": "inlineCode", - "value": "value" - }, - { - "type": "text", - "value": ", is an optional number or string. If provided,\nas in " - }, - { - "type": "inlineCode", - "value": "myElement.value(123)" - }, - { - "type": "text", - "value": ", it's used to set the element's value." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "value" - }, - { - "title": "return", - "description": "value of the element.", - "lineNumber": 9, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 2997, - "column": 0, - "index": 90151 - }, - "end": { - "line": 3060, - "column": 3, - "index": 91639 - } - }, - "context": { - "loc": { - "start": { - "line": 3066, - "column": 0, - "index": 91716 - }, - "end": { - "line": 3075, - "column": 2, - "index": 91966 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value of the element." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "value", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "value", - "kind": "function" - } - ], - "namespace": "value" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "value" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "value" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 3061, - "column": 0, - "index": 91640 - }, - "end": { - "line": 3065, - "column": 3, - "index": 91715 - } - }, - "context": { - "loc": { - "start": { - "line": 3066, - "column": 0, - "index": 91716 - }, - "end": { - "line": 3075, - "column": 2, - "index": 91966 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "value", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "value", - "kind": "function" - } - ], - "namespace": "value" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Shows the current element." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 3, - "name": "show" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 3077, - "column": 0, - "index": 91968 - }, - "end": { - "line": 3104, - "column": 3, - "index": 92470 - } - }, - "context": { - "loc": { - "start": { - "line": 3105, - "column": 0, - "index": 92471 - }, - "end": { - "line": 3108, - "column": 2, - "index": 92566 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "show", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "show", - "kind": "function" - } - ], - "namespace": "show" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Hides the current element." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 3, - "name": "hide" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - }, - { - "title": "example", - "description": "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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 3110, - "column": 0, - "index": 92568 - }, - "end": { - "line": 3134, - "column": 3, - "index": 93053 - } - }, - "context": { - "loc": { - "start": { - "line": 3135, - "column": 0, - "index": 93054 - }, - "end": { - "line": 3138, - "column": 2, - "index": 93148 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "hide", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "hide", - "kind": "function" - } - ], - "namespace": "hide" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the element's width and height." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "inlineCode", - "value": "myElement.size()" - }, - { - "type": "text", - "value": " without an argument returns the element's size\nas an object with the properties " - }, - { - "type": "inlineCode", - "value": "width" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "height" - }, - { - "type": "text", - "value": ". For example,\n" - }, - { - "type": "inlineCode", - "value": "{ width: 20, height: 10 }" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "width" - }, - { - "type": "text", - "value": ", is optional. It's a number used to set the\nelement's width. Calling " - }, - { - "type": "inlineCode", - "value": "myElement.size(10)" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, 'height" - }, - { - "type": "inlineCode", - "value": ", is also optional. It's a\nnumber used to set the element's height. For example, calling\n" - }, - { - "type": "text", - "value": "myElement.size(20, 10)` sets the element's width to 20 pixels and height\nto 10 pixels." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The constant " - }, - { - "type": "inlineCode", - "value": "AUTO" - }, - { - "type": "text", - "value": " can be used to adjust one dimension at a time while\nmaintaining the aspect ratio, which is " - }, - { - "type": "inlineCode", - "value": "width / height" - }, - { - "type": "text", - "value": ". For example,\nconsider an element that's 200 pixels wide and 100 pixels tall. Calling\n" - }, - { - "type": "inlineCode", - "value": "myElement.size(20, AUTO)" - }, - { - "type": "text", - "value": " sets the width to 20 pixels and height to 10\npixels." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: In the case of elements that need to load data, such as images, wait\nto call " - }, - { - "type": "inlineCode", - "value": "myElement.size()" - }, - { - "type": "text", - "value": " until after the data loads." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 24, - "name": "size" - }, - { - "title": "return", - "description": "width and height of the element in an object.", - "lineNumber": 25, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 26 - } - ], - "loc": { - "start": { - "line": 3140, - "column": 0, - "index": 93150 - }, - "end": { - "line": 3243, - "column": 3, - "index": 96170 - } - }, - "context": { - "loc": { - "start": { - "line": 3250, - "column": 0, - "index": 96368 - }, - "end": { - "line": 3297, - "column": 2, - "index": 97949 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "width and height of the element in an object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "size", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "size", - "kind": "function" - } - ], - "namespace": "size" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "size" - }, - { - "title": "param", - "description": "width of the element, either AUTO, or a number.", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "AUTO" - } - ] - }, - "name": "w" - }, - { - "title": "param", - "description": "height of the element, either AUTO, or a number.", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "AUTO" - } - ] - } - }, - "name": "h" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 3244, - "column": 0, - "index": 96171 - }, - "end": { - "line": 3249, - "column": 3, - "index": 96367 - } - }, - "context": { - "loc": { - "start": { - "line": 3250, - "column": 0, - "index": 96368 - }, - "end": { - "line": 3297, - "column": 2, - "index": 97949 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "w", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "width of the element, either AUTO, or a number." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "AUTO" - } - ] - } - }, - { - "title": "param", - "name": "h", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "height of the element, either AUTO, or a number." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "AUTO" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "size", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "size", - "kind": "function" - } - ], - "namespace": "size" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes the element, stops all audio/video streams, and removes all\ncallback functions." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "remove" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 3299, - "column": 0, - "index": 97951 - }, - "end": { - "line": 3325, - "column": 3, - "index": 98460 - } - }, - "context": { - "loc": { - "start": { - "line": 3326, - "column": 0, - "index": 98461 - }, - "end": { - "line": 3353, - "column": 2, - "index": 99256 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "remove", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "remove", - "kind": "function" - } - ], - "namespace": "remove" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets a function to call when the user drops a file on the element." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "callback" - }, - { - "type": "text", - "value": ", is a function to call once the file loads.\nThe callback function should have one parameter, " - }, - { - "type": "inlineCode", - "value": "file" - }, - { - "type": "text", - "value": ", that's a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.File" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object. If the user drops multiple files on\nthe element, " - }, - { - "type": "inlineCode", - "value": "callback" - }, - { - "type": "text", - "value": ", is called once for each file." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "fxn" - }, - { - "type": "text", - "value": ", is a function to call when the browser detects\none or more dropped files. The callback function should have one\nparameter, " - }, - { - "type": "inlineCode", - "value": "event" - }, - { - "type": "text", - "value": ", that's a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "DragEvent" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 13, - "name": "drop" - }, - { - "title": "param", - "description": "called when a file loads. Called once for each file dropped.", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Function" - }, - "name": "callback" - }, - { - "title": "param", - "description": "called once when any files are dropped.", - "lineNumber": 15, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Function" - } - }, - "name": "fxn" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 16 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 17 - } - ], - "loc": { - "start": { - "line": 3355, - "column": 0, - "index": 99258 - }, - "end": { - "line": 3465, - "column": 3, - "index": 102135 - } - }, - "context": { - "loc": { - "start": { - "line": 3466, - "column": 0, - "index": 102136 - }, - "end": { - "line": 3509, - "column": 2, - "index": 103454 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "callback", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "called when a file loads. Called once for each file dropped." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Function" - } - }, - { - "title": "param", - "name": "fxn", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "called once when any files are dropped." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Function" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "drop", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "drop", - "kind": "function" - } - ], - "namespace": "drop" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 3, - "name": "draggable" - }, - { - "title": "param", - "description": "pass another p5.Element", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Element" - } - }, - "name": "elmnt" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 3511, - "column": 0, - "index": 103456 - }, - "end": { - "line": 3556, - "column": 3, - "index": 104723 - } - }, - "context": { - "loc": { - "start": { - "line": 3557, - "column": 0, - "index": 104724 - }, - "end": { - "line": 3623, - "column": 2, - "index": 106562 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "elmnt", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pass another p5.Element" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5.Element" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "draggable", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "draggable", - "kind": "function" - } - ], - "namespace": "draggable" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A class to handle audio and video." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "p5.MediaElement" - }, - { - "type": "text", - "value": " extends " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " with\nmethods to handle audio and video. " - }, - { - "type": "inlineCode", - "value": "p5.MediaElement" - }, - { - "type": "text", - "value": " objects are created by\ncalling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createVideo" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createAudio" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCapture" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 9, - "type": null, - "name": "p5.MediaElement" - }, - { - "title": "param", - "description": "DOM node that is wrapped", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "elt" - }, - { - "title": "extends", - "description": null, - "lineNumber": 11, - "type": null, - "name": "p5.Element" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 3643, - "column": 0, - "index": 107126 - }, - "end": { - "line": 3675, - "column": 3, - "index": 108021 - } - }, - "context": { - "loc": { - "start": { - "line": 3676, - "column": 0, - "index": 108022 - }, - "end": { - "line": 4840, - "column": 2, - "index": 139684 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [ - { - "title": "extends", - "description": null, - "lineNumber": 11, - "type": null, - "name": "p5.Element" - } - ], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "elt", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "DOM node that is wrapped" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "class", - "name": "p5.MediaElement", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.MediaElement", - "kind": "class" - } - ], - "namespace": "p5.MediaElement" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "volume" - }, - { - "title": "param", - "description": "volume between 0.0 and 1.0.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "val" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 4140, - "column": 2, - "index": 120186 - }, - "end": { - "line": 4144, - "column": 5, - "index": 120295 - } - }, - "context": { - "loc": { - "start": { - "line": 4145, - "column": 2, - "index": 120298 - }, - "end": { - "line": 4151, - "column": 3, - "index": 120431 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "val", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "volume between 0.0 and 1.0." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "volume", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "volume", - "kind": "function" - } - ], - "namespace": "volume" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A class to describe a file." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "p5.File" - }, - { - "type": "text", - "value": " objects are used by\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "myElement.drop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and\ncreated by\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createFileInput" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 8, - "type": null, - "name": "p5.File" - }, - { - "title": "param", - "description": "wrapped file.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "File" - }, - "name": "file" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 4871, - "column": 0, - "index": 140234 - }, - "end": { - "line": 4957, - "column": 3, - "index": 142393 - } - }, - "context": { - "loc": { - "start": { - "line": 4958, - "column": 0, - "index": 142394 - }, - "end": { - "line": 5009, - "column": 2, - "index": 143967 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "file", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "wrapped file." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "File" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "class", - "name": "p5.File", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.File", - "kind": "class" - } - ], - "namespace": "p5.File" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Underlying\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "File" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nobject. All " - }, - { - "type": "inlineCode", - "value": "File" - }, - { - "type": "text", - "value": " properties and methods are accessible." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.File", - "lineNumber": 5 - }, - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "file" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 5011, - "column": 0, - "index": 143969 - }, - "end": { - "line": 5050, - "column": 3, - "index": 145025 - } - }, - "context": { - "loc": { - "start": { - "line": 5235, - "column": 0, - "index": 149544 - }, - "end": { - "line": 5235, - "column": 18, - "index": 149562 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dom", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "dom" - } - ], - "namespace": "dom" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The file\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "MIME type" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nas a string. For example, " - }, - { - "type": "inlineCode", - "value": "'image'" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "'text'" - }, - { - "type": "text", - "value": ", and so on." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.File", - "lineNumber": 5 - }, - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "type" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 5052, - "column": 0, - "index": 145027 - }, - "end": { - "line": 5087, - "column": 3, - "index": 145974 - } - }, - "context": { - "loc": { - "start": { - "line": 5235, - "column": 0, - "index": 149544 - }, - "end": { - "line": 5235, - "column": 18, - "index": 149562 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dom", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "dom" - } - ], - "namespace": "dom" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The file subtype as a string. For example, a file with an " - }, - { - "type": "inlineCode", - "value": "'image'" - }, - { - "type": "text", - "value": "\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "MIME type" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nmay have a subtype such as " - }, - { - "type": "inlineCode", - "value": "png" - }, - { - "type": "text", - "value": " or " - }, - { - "type": "inlineCode", - "value": "jpeg" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "subtype" - }, - { - "title": "for", - "description": "p5.File", - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 5089, - "column": 0, - "index": 145976 - }, - "end": { - "line": 5124, - "column": 3, - "index": 146996 - } - }, - "context": { - "loc": { - "start": { - "line": 5235, - "column": 0, - "index": 149544 - }, - "end": { - "line": 5235, - "column": 18, - "index": 149562 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dom", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "dom" - } - ], - "namespace": "dom" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The file name as a string." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.File", - "lineNumber": 3 - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "name" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 5126, - "column": 0, - "index": 146998 - }, - "end": { - "line": 5159, - "column": 3, - "index": 147783 - } - }, - "context": { - "loc": { - "start": { - "line": 5235, - "column": 0, - "index": 149544 - }, - "end": { - "line": 5235, - "column": 18, - "index": 149562 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dom", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "dom" - } - ], - "namespace": "dom" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The number of bytes in the file." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.File", - "lineNumber": 3 - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "size" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 5161, - "column": 0, - "index": 147785 - }, - "end": { - "line": 5194, - "column": 3, - "index": 148594 - } - }, - "context": { - "loc": { - "start": { - "line": 5235, - "column": 0, - "index": 149544 - }, - "end": { - "line": 5235, - "column": 18, - "index": 149562 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dom", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "dom" - } - ], - "namespace": "dom" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A string containing either the file's image data, text contents, or\na parsed object in the case of JSON and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.XML" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " objects." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.File", - "lineNumber": 5 - }, - { - "title": "property", - "description": null, - "lineNumber": 6, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "data" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 5196, - "column": 0, - "index": 148596 - }, - "end": { - "line": 5233, - "column": 3, - "index": 149542 - } - }, - "context": { - "loc": { - "start": { - "line": 5235, - "column": 0, - "index": 149544 - }, - "end": { - "line": 5235, - "column": 18, - "index": 149562 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/dom/dom.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "dom", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "dom" - } - ], - "namespace": "dom" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Events" - }, - { - "title": "submodule", - "description": "Acceleration", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - }, - { - "title": "main", - "description": "Events", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 7, - "column": 3, - "index": 97 - } - }, - "context": { - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 99 - }, - "end": { - "line": 9, - "column": 30, - "index": 129 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Events", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Events", - "kind": "module" - } - ], - "namespace": "Events" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Events" - }, - { - "title": "submodule", - "description": "Keyboard", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 77 - } - }, - "context": { - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 79 - }, - "end": { - "line": 8, - "column": 30, - "index": 109 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Events", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Events", - "kind": "module" - } - ], - "namespace": "Events" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Events" - }, - { - "title": "submodule", - "description": "Mouse", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - }, - { - "title": "requires", - "description": null, - "lineNumber": 5, - "name": "constants" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 7, - "column": 3, - "index": 97 - } - }, - "context": { - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 99 - }, - "end": { - "line": 9, - "column": 30, - "index": 129 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Events", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Events", - "kind": "module" - } - ], - "namespace": "Events" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Events" - }, - { - "title": "submodule", - "description": "Touch", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 74 - } - }, - "context": { - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 76 - }, - "end": { - "line": 8, - "column": 30, - "index": 106 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/touch.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Events", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Events", - "kind": "module" - } - ], - "namespace": "Events" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setMoveThreshold()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is used to set the movement threshold for\nthe " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "deviceMoved()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function. The default threshold is set to 0.5." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "setMoveThreshold" - }, - { - "title": "param", - "description": "The threshold value", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "number" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 418, - "column": 0, - "index": 11916 - }, - "end": { - "line": 453, - "column": 3, - "index": 12943 - } - }, - "context": { - "loc": { - "start": { - "line": 455, - "column": 0, - "index": 12945 - }, - "end": { - "line": 458, - "column": 2, - "index": 13076 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The threshold value" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "setMoveThreshold", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setMoveThreshold", - "kind": "function" - } - ], - "namespace": "setMoveThreshold" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setShakeThreshold()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is used to set the movement threshold for\nthe " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "deviceShaken()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function. The default threshold is set to 30." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "setShakeThreshold" - }, - { - "title": "param", - "description": "The threshold value", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "number" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 460, - "column": 0, - "index": 13078 - }, - "end": { - "line": 495, - "column": 3, - "index": 14105 - } - }, - "context": { - "loc": { - "start": { - "line": 497, - "column": 0, - "index": 14107 - }, - "end": { - "line": 500, - "column": 2, - "index": 14241 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The threshold value" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "setShakeThreshold", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setShakeThreshold", - "kind": "function" - } - ], - "namespace": "setShakeThreshold" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "deviceMoved()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setMoveThreshold()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "deviceMoved" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 502, - "column": 0, - "index": 14243 - }, - "end": { - "line": 530, - "column": 3, - "index": 15065 - } - }, - "context": { - "loc": { - "start": { - "line": 620, - "column": 0, - "index": 17442 - }, - "end": { - "line": 631, - "column": 2, - "index": 17840 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "deviceMoved", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "deviceMoved", - "kind": "function" - } - ], - "namespace": "deviceMoved" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "deviceTurned()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is called when the device rotates by\nmore than 90 degrees continuously." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The axis that triggers the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "deviceTurned()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method is stored in the turnAxis\nvariable. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "deviceTurned()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method can be locked to trigger on any axis:\nX, Y or Z by comparing the turnAxis variable to 'X', 'Y' or 'Z'." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "deviceTurned" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 532, - "column": 0, - "index": 15067 - }, - "end": { - "line": 588, - "column": 3, - "index": 16580 - } - }, - "context": { - "loc": { - "start": { - "line": 620, - "column": 0, - "index": 17442 - }, - "end": { - "line": 631, - "column": 2, - "index": 17840 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "deviceTurned", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "deviceTurned", - "kind": "function" - } - ], - "namespace": "deviceTurned" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "deviceShaken()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setShakeThreshold()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "deviceShaken" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 590, - "column": 0, - "index": 16582 - }, - "end": { - "line": 618, - "column": 3, - "index": 17440 - } - }, - "context": { - "loc": { - "start": { - "line": 620, - "column": 0, - "index": 17442 - }, - "end": { - "line": 631, - "column": 2, - "index": 17840 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/acceleration.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "deviceShaken", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "deviceShaken", - "kind": "function" - } - ], - "namespace": "deviceShaken" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyPressed()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is called once every time a key is pressed. The\nkeyCode for the key that was pressed is stored in the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyCode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " variable." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyTyped()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to read the key variable, in which the\ncase of the variable will be distinguished." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Because of how operating systems handle key repeats, holding down a key\nmay cause multiple calls to " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyTyped()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " (and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyReleased()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " as well). The\nrate of repeat is set by the operating system and how each computer is\nconfigured." - }, - { - "type": "html", - "value": "
" - }, - { - "type": "html", - "value": "
" - }, - { - "type": "text", - "value": "\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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 21, - "name": "keyPressed" - }, - { - "title": "param", - "description": "optional KeyboardEvent callback argument.", - "lineNumber": 22, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "KeyboardEvent" - } - }, - "name": "event" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 23 - } - ], - "loc": { - "start": { - "line": 98, - "column": 0, - "index": 2453 - }, - "end": { - "line": 166, - "column": 3, - "index": 4696 - } - }, - "context": { - "loc": { - "start": { - "line": 167, - "column": 0, - "index": 4697 - }, - "end": { - "line": 184, - "column": 2, - "index": 5296 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "event", - "lineNumber": 22, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional KeyboardEvent callback argument." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "KeyboardEvent" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "keyPressed", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "keyPressed", - "kind": "function" - } - ], - "namespace": "keyPressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyReleased()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is called once every time a key is released.\nSee " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "key" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyCode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for more information." - }, - { - "type": "html", - "value": "
" - }, - { - "type": "html", - "value": "
" - }, - { - "type": "text", - "value": "\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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 7, - "name": "keyReleased" - }, - { - "title": "param", - "description": "optional KeyboardEvent callback argument.", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "KeyboardEvent" - } - }, - "name": "event" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 185, - "column": 0, - "index": 5297 - }, - "end": { - "line": 214, - "column": 3, - "index": 6208 - } - }, - "context": { - "loc": { - "start": { - "line": 215, - "column": 0, - "index": 6209 - }, - "end": { - "line": 235, - "column": 2, - "index": 6805 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "event", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional KeyboardEvent callback argument." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "KeyboardEvent" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "keyReleased", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "keyReleased", - "kind": "function" - } - ], - "namespace": "keyReleased" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyTyped()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyPressed()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function instead.\nThe most recent key typed will be stored in the key variable." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Because of how operating systems handle key repeats, holding down a key\nwill cause multiple calls to " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyTyped()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " (and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyReleased()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " as well). The\nrate of repeat is set by the operating system and how each computer is\nconfigured." - }, - { - "type": "html", - "value": "
" - }, - { - "type": "html", - "value": "
" - }, - { - "type": "text", - "value": "\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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 14, - "name": "keyTyped" - }, - { - "title": "param", - "description": "optional KeyboardEvent callback argument.", - "lineNumber": 15, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "KeyboardEvent" - } - }, - "name": "event" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 16 - } - ], - "loc": { - "start": { - "line": 237, - "column": 0, - "index": 6807 - }, - "end": { - "line": 274, - "column": 3, - "index": 8228 - } - }, - "context": { - "loc": { - "start": { - "line": 275, - "column": 0, - "index": 8229 - }, - "end": { - "line": 290, - "column": 2, - "index": 8734 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "event", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional KeyboardEvent callback argument." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "KeyboardEvent" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "keyTyped", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "keyTyped", - "kind": "function" - } - ], - "namespace": "keyTyped" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyIsDown()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "keyCode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " names listed\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "here" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "keyIsDown" - }, - { - "title": "param", - "description": "The key to check for.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "code" - }, - { - "title": "return", - "description": "whether key is down or not", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 301, - "column": 0, - "index": 9043 - }, - "end": { - "line": 371, - "column": 3, - "index": 10779 - } - }, - "context": { - "loc": { - "start": { - "line": 372, - "column": 0, - "index": 10780 - }, - "end": { - "line": 375, - "column": 2, - "index": 10914 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/keyboard.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "code", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The key to check for." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "whether key is down or not" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "keyIsDown", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "keyIsDown", - "kind": "function" - } - ], - "namespace": "keyIsDown" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "mouseMoved()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is called every time the mouse moves and a mouse\nbutton is not pressed." - }, - { - "type": "html", - "value": "
" - }, - { - "type": "html", - "value": "
" - }, - { - "type": "text", - "value": "\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 method." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 7, - "name": "mouseMoved" - }, - { - "title": "param", - "description": "optional MouseEvent callback argument.", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "MouseEvent" - } - }, - "name": "event" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 469, - "column": 0, - "index": 12173 - }, - "end": { - "line": 519, - "column": 3, - "index": 13391 - } - }, - "context": { - "loc": { - "start": { - "line": 573, - "column": 0, - "index": 14783 - }, - "end": { - "line": 597, - "column": 2, - "index": 15517 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "event", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional MouseEvent callback argument." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "MouseEvent" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "mouseMoved", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mouseMoved", - "kind": "function" - } - ], - "namespace": "mouseMoved" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "mouseDragged()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is called once every time the mouse moves and\na mouse button is pressed. If no " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "mouseDragged()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is defined, the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "touchMoved()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function will be called instead if it is defined." - }, - { - "type": "html", - "value": "
" - }, - { - "type": "html", - "value": "
" - }, - { - "type": "text", - "value": "\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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "mouseDragged" - }, - { - "title": "param", - "description": "optional MouseEvent callback argument.", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "MouseEvent" - } - }, - "name": "event" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 521, - "column": 0, - "index": 13393 - }, - "end": { - "line": 572, - "column": 3, - "index": 14782 - } - }, - "context": { - "loc": { - "start": { - "line": 573, - "column": 0, - "index": 14783 - }, - "end": { - "line": 597, - "column": 2, - "index": 15517 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "event", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional MouseEvent callback argument." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "MouseEvent" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "mouseDragged", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mouseDragged", - "kind": "function" - } - ], - "namespace": "mouseDragged" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "mousePressed()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is called once after every time a mouse button\nis pressed. The mouseButton variable (see the related reference entry)\ncan be used to determine which button has been pressed. If no\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "mousePressed()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is defined, the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "touchStarted()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function will be\ncalled instead if it is defined." - }, - { - "type": "html", - "value": "
" - }, - { - "type": "html", - "value": "
" - }, - { - "type": "text", - "value": "\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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 10, - "name": "mousePressed" - }, - { - "title": "param", - "description": "optional MouseEvent callback argument.", - "lineNumber": 11, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "MouseEvent" - } - }, - "name": "event" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 599, - "column": 0, - "index": 15519 - }, - "end": { - "line": 652, - "column": 3, - "index": 17045 - } - }, - "context": { - "loc": { - "start": { - "line": 653, - "column": 0, - "index": 17046 - }, - "end": { - "line": 675, - "column": 2, - "index": 17742 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "event", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional MouseEvent callback argument." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "MouseEvent" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "mousePressed", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mousePressed", - "kind": "function" - } - ], - "namespace": "mousePressed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "mouseReleased()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is called every time a mouse button is\nreleased. If no " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "mouseReleased()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is defined, the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "touchEnded()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfunction will be called instead if it is defined." - }, - { - "type": "html", - "value": "
" - }, - { - "type": "html", - "value": "
" - }, - { - "type": "text", - "value": "\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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "mouseReleased" - }, - { - "title": "param", - "description": "optional MouseEvent callback argument.", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "MouseEvent" - } - }, - "name": "event" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 677, - "column": 0, - "index": 17744 - }, - "end": { - "line": 729, - "column": 3, - "index": 19144 - } - }, - "context": { - "loc": { - "start": { - "line": 730, - "column": 0, - "index": 19145 - }, - "end": { - "line": 745, - "column": 2, - "index": 19646 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "event", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional MouseEvent callback argument." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "MouseEvent" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "mouseReleased", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mouseReleased", - "kind": "function" - } - ], - "namespace": "mouseReleased" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "mouseClicked()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is called once after a mouse button has been\npressed and then released." - }, - { - "type": "html", - "value": "
" - }, - { - "type": "html", - "value": "
" - }, - { - "type": "text", - "value": "\nBrowsers handle clicks differently, so this function is only guaranteed to be\nrun when the left mouse button is clicked. To handle other mouse buttons\nbeing pressed or released, see " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "mousePressed()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "mouseReleased()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - }, - { - "type": "html", - "value": "
" - }, - { - "type": "html", - "value": "
" - }, - { - "type": "text", - "value": "\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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 10, - "name": "mouseClicked" - }, - { - "title": "param", - "description": "optional MouseEvent callback argument.", - "lineNumber": 11, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "MouseEvent" - } - }, - "name": "event" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 750, - "column": 0, - "index": 19754 - }, - "end": { - "line": 805, - "column": 3, - "index": 21297 - } - }, - "context": { - "loc": { - "start": { - "line": 806, - "column": 0, - "index": 21298 - }, - "end": { - "line": 814, - "column": 2, - "index": 21564 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "event", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional MouseEvent callback argument." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "MouseEvent" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "mouseClicked", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mouseClicked", - "kind": "function" - } - ], - "namespace": "mouseClicked" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "doubleClicked()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is executed every time a event\nlistener has detected a dblclick event which is a part of the\nDOM L3 specification. The doubleClicked event is fired when a\npointing device button (usually a mouse's primary button)\nis clicked twice on a single element. For more info on the\ndblclick event refer to mozilla's documentation here:\n" - }, - { - "type": "link", - "title": null, - "url": "https://developer.mozilla.org/en-US/docs/Web/Events/dblclick", - "children": [ - { - "type": "text", - "value": "https://developer.mozilla.org/en-US/docs/Web/Events/dblclick" - } - ] - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "doubleClicked" - }, - { - "title": "param", - "description": "optional MouseEvent callback argument.", - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "MouseEvent" - } - }, - "name": "event" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 816, - "column": 0, - "index": 21566 - }, - "end": { - "line": 870, - "column": 3, - "index": 22967 - } - }, - "context": { - "loc": { - "start": { - "line": 872, - "column": 0, - "index": 22969 - }, - "end": { - "line": 880, - "column": 2, - "index": 23240 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "event", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional MouseEvent callback argument." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "MouseEvent" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "doubleClicked", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "doubleClicked", - "kind": "function" - } - ], - "namespace": "doubleClicked" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The function " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "mouseWheel()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is executed every time a vertical mouse wheel\nevent is detected either triggered by an actual mouse wheel or by a\ntouchpad." - }, - { - "type": "html", - "value": "
" - }, - { - "type": "html", - "value": "
" - }, - { - "type": "text", - "value": "\nThe event.delta property returns the amount the mouse wheel\nhave scrolled. The values can be positive or negative depending on the\nscroll direction (on macOS with \"natural\" scrolling enabled, the signs\nare inverted)." - }, - { - "type": "html", - "value": "
" - }, - { - "type": "html", - "value": "
" - }, - { - "type": "text", - "value": "\nBrowsers may have different default behaviors attached to various\nmouse events. To prevent any default behavior for this event, add\n\"return false\" to the end of the method." - }, - { - "type": "html", - "value": "
" - }, - { - "type": "html", - "value": "
" - }, - { - "type": "text", - "value": "\nDue to the current support of the \"wheel\" event on Safari, the function\nmay only work as expected if \"return false\" is included while using Safari." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 14, - "name": "mouseWheel" - }, - { - "title": "param", - "description": "optional WheelEvent callback argument.", - "lineNumber": 15, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "WheelEvent" - } - }, - "name": "event" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 17 - } - ], - "loc": { - "start": { - "line": 898, - "column": 0, - "index": 23536 - }, - "end": { - "line": 937, - "column": 3, - "index": 24909 - } - }, - "context": { - "loc": { - "start": { - "line": 938, - "column": 0, - "index": 24910 - }, - "end": { - "line": 948, - "column": 2, - "index": 25248 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "event", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional WheelEvent callback argument." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "WheelEvent" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "mouseWheel", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mouseWheel", - "kind": "function" - } - ], - "namespace": "mouseWheel" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The function " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "requestPointerLock()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nlocks the pointer to its current position and makes it invisible.\nUse " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "movedX" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "movedY" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 10, - "name": "requestPointerLock" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 950, - "column": 0, - "index": 25250 - }, - "end": { - "line": 981, - "column": 3, - "index": 26276 - } - }, - "context": { - "loc": { - "start": { - "line": 982, - "column": 0, - "index": 26277 - }, - "end": { - "line": 993, - "column": 2, - "index": 26687 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "requestPointerLock", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "requestPointerLock", - "kind": "function" - } - ], - "namespace": "requestPointerLock" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The function " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "exitPointerLock()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nexits a previously triggered " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pointer Lock" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfor example to make ui elements usable etc" - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "exitPointerLock" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 995, - "column": 0, - "index": 26689 - }, - "end": { - "line": 1022, - "column": 3, - "index": 27394 - } - }, - "context": { - "loc": { - "start": { - "line": 1023, - "column": 0, - "index": 27395 - }, - "end": { - "line": 1025, - "column": 2, - "index": 27471 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/mouse.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "exitPointerLock", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "exitPointerLock", - "kind": "function" - } - ], - "namespace": "exitPointerLock" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The touchStarted() function is called once after every time a touch is\nregistered. If no " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "touchStarted()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is defined, the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "mousePressed()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfunction will be called instead if it is defined." - }, - { - "type": "html", - "value": "
" - }, - { - "type": "html", - "value": "
" - }, - { - "type": "text", - "value": "\nBrowsers may have different default behaviors attached to various touch\nevents. To prevent any default behavior for this event, add \"return false\"\nto the end of the method." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "touchStarted" - }, - { - "title": "param", - "description": "optional TouchEvent callback argument.", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "TouchEvent" - } - }, - "name": "event" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 70, - "column": 0, - "index": 1667 - }, - "end": { - "line": 123, - "column": 3, - "index": 3060 - } - }, - "context": { - "loc": { - "start": { - "line": 124, - "column": 0, - "index": 3061 - }, - "end": { - "line": 147, - "column": 2, - "index": 3841 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/touch.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "event", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional TouchEvent callback argument." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "TouchEvent" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "touchStarted", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "touchStarted", - "kind": "function" - } - ], - "namespace": "touchStarted" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "touchMoved()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is called every time a touch move is registered.\nIf no " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "touchMoved()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is defined, the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "mouseDragged()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function will\nbe called instead if it is defined." - }, - { - "type": "html", - "value": "
" - }, - { - "type": "html", - "value": "
" - }, - { - "type": "text", - "value": "\nBrowsers may have different default behaviors attached to various touch\nevents. To prevent any default behavior for this event, add \"return false\"\nto the end of the method." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "touchMoved" - }, - { - "title": "param", - "description": "optional TouchEvent callback argument.", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "TouchEvent" - } - }, - "name": "event" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 149, - "column": 0, - "index": 3843 - }, - "end": { - "line": 201, - "column": 3, - "index": 5244 - } - }, - "context": { - "loc": { - "start": { - "line": 202, - "column": 0, - "index": 5245 - }, - "end": { - "line": 218, - "column": 2, - "index": 5764 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/touch.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "event", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional TouchEvent callback argument." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "TouchEvent" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "touchMoved", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "touchMoved", - "kind": "function" - } - ], - "namespace": "touchMoved" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "touchEnded()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is called every time a touch ends. If no\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "touchEnded()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function is defined, the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "mouseReleased()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function will be\ncalled instead if it is defined." - }, - { - "type": "html", - "value": "
" - }, - { - "type": "html", - "value": "
" - }, - { - "type": "text", - "value": "\nBrowsers may have different default behaviors attached to various touch\nevents. To prevent any default behavior for this event, add \"return false\"\nto the end of the method." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "touchEnded" - }, - { - "title": "param", - "description": "optional TouchEvent callback argument.", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "TouchEvent" - } - }, - "name": "event" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 220, - "column": 0, - "index": 5766 - }, - "end": { - "line": 273, - "column": 3, - "index": 7159 - } - }, - "context": { - "loc": { - "start": { - "line": 274, - "column": 0, - "index": 7160 - }, - "end": { - "line": 291, - "column": 2, - "index": 7726 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/events/touch.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "event", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional TouchEvent callback argument." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "TouchEvent" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "touchEnded", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "touchEnded", - "kind": "function" - } - ], - "namespace": "touchEnded" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Image" - }, - { - "title": "submodule", - "description": "Image", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 73 - } - }, - "context": { - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 219 - }, - "end": { - "line": 12, - "column": 30, - "index": 249 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/image.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Image", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Image", - "kind": "module" - } - ], - "namespace": "Image" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Image" - }, - { - "title": "submodule", - "description": "Loading & Displaying", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 88 - } - }, - "context": { - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 90 - }, - "end": { - "line": 8, - "column": 30, - "index": 120 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/loading_displaying.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Image", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Image", - "kind": "module" - } - ], - "namespace": "Image" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Image" - }, - { - "title": "submodule", - "description": "Image", - "lineNumber": 2 - }, - { - "title": "requires", - "description": null, - "lineNumber": 3, - "name": "core" - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "constants" - }, - { - "title": "requires", - "description": null, - "lineNumber": 5, - "name": "filters" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 7, - "column": 3, - "index": 106 - } - }, - "context": { - "loc": { - "start": { - "line": 14, - "column": 0, - "index": 249 - }, - "end": { - "line": 14, - "column": 30, - "index": 279 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Image", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Image", - "kind": "module" - } - ], - "namespace": "Image" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Image" - }, - { - "title": "submodule", - "description": "Pixels", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 74 - } - }, - "context": { - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 76 - }, - "end": { - "line": 8, - "column": 30, - "index": 106 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Image", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Image", - "kind": "module" - } - ], - "namespace": "Image" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object. The new image is\ntransparent by default." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "createImage()" - }, - { - "type": "text", - "value": " uses the " - }, - { - "type": "inlineCode", - "value": "width" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "height" - }, - { - "type": "text", - "value": " paremeters to set the new\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object's dimensions in pixels. The new\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " can be modified by updating its\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixels" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " array or by calling its\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "get()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "set()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " methods. The\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadPixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method must be called\nbefore reading or modifying pixel values. The\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "updatePixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method must be called\nfor updates to take effect." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 15, - "name": "createImage" - }, - { - "title": "param", - "description": "width in pixels.", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "width" - }, - { - "title": "param", - "description": "height in pixels.", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "height" - }, - { - "title": "return", - "description": "new p5.Image object.", - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "p5.Image" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 19 - } - ], - "loc": { - "start": { - "line": 15, - "column": 0, - "index": 285 - }, - "end": { - "line": 91, - "column": 3, - "index": 2518 - } - }, - "context": { - "loc": { - "start": { - "line": 92, - "column": 0, - "index": 2519 - }, - "end": { - "line": 95, - "column": 2, - "index": 2664 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "width", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "width in pixels." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "height", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "height in pixels." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Image" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createImage", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createImage", - "kind": "function" - } - ], - "namespace": "createImage" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Saves the current canvas as an image. The browser will either save the\nfile immediately or prompt the user with a dialogue window." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "saveCanvas" - }, - { - "title": "param", - "description": "reference to a\n specific HTML5 canvas element.", - "lineNumber": 5, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Framebuffer" - }, - { - "type": "NameExpression", - "name": "p5.Element" - }, - { - "type": "NameExpression", - "name": "HTMLCanvasElement" - } - ] - }, - "name": "selectedCanvas" - }, - { - "title": "param", - "description": "file name. Defaults to 'untitled'.", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "filename" - }, - { - "title": "param", - "description": "file extension, either 'jpg' or 'png'. Defaults to 'png'.", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "extension" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 97, - "column": 0, - "index": 2666 - }, - "end": { - "line": 167, - "column": 3, - "index": 4238 - } - }, - "context": { - "loc": { - "start": { - "line": 173, - "column": 0, - "index": 4335 - }, - "end": { - "line": 230, - "column": 2, - "index": 5860 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "selectedCanvas", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "reference to a\nspecific HTML5 canvas element." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Framebuffer" - }, - { - "type": "NameExpression", - "name": "p5.Element" - }, - { - "type": "NameExpression", - "name": "HTMLCanvasElement" - } - ] - } - }, - { - "title": "param", - "name": "filename", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "file name. Defaults to 'untitled'." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - }, - { - "title": "param", - "name": "extension", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "file extension, either 'jpg' or 'png'. Defaults to 'png'." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "saveCanvas", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "saveCanvas", - "kind": "function" - } - ], - "namespace": "saveCanvas" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "saveCanvas" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "filename" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "extension" - } - ], - "loc": { - "start": { - "line": 168, - "column": 0, - "index": 4239 - }, - "end": { - "line": 172, - "column": 3, - "index": 4334 - } - }, - "context": { - "loc": { - "start": { - "line": 173, - "column": 0, - "index": 4335 - }, - "end": { - "line": 230, - "column": 2, - "index": 5860 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/image.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "filename", - "lineNumber": 2, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - }, - { - "title": "param", - "name": "extension", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "saveCanvas", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "saveCanvas", - "kind": "function" - } - ], - "namespace": "saveCanvas" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "filename" - }, - { - "type": "text", - "value": ", sets the prefix for the file names. For\nexample, setting the prefix to " - }, - { - "type": "inlineCode", - "value": "'frame'" - }, - { - "type": "text", - "value": " would generate the image files\n" - }, - { - "type": "inlineCode", - "value": "frame0.png" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "frame1.png" - }, - { - "type": "text", - "value": ", and so on. The second parameter, " - }, - { - "type": "inlineCode", - "value": "extension" - }, - { - "type": "text", - "value": ",\nsets the file type to either " - }, - { - "type": "inlineCode", - "value": "'png'" - }, - { - "type": "text", - "value": " or " - }, - { - "type": "inlineCode", - "value": "'jpg'" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The third parameter, " - }, - { - "type": "inlineCode", - "value": "duration" - }, - { - "type": "text", - "value": ", sets the duration to record in seconds.\nThe maximum duration is 15 seconds. The fourth parameter, " - }, - { - "type": "inlineCode", - "value": "framerate" - }, - { - "type": "text", - "value": ", sets\nthe number of frames to record per second. The maximum frame rate value is\n22. Limits are placed on " - }, - { - "type": "inlineCode", - "value": "duration" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "framerate" - }, - { - "type": "text", - "value": " to avoid using too much\nmemory. Recording large canvases can easily crash sketches or even web\nbrowsers." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The fifth parameter, " - }, - { - "type": "inlineCode", - "value": "callback" - }, - { - "type": "text", - "value": ", 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: " - }, - { - "type": "inlineCode", - "value": "imageData" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "filename" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "extension" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 22, - "name": "saveFrames" - }, - { - "title": "param", - "description": "prefix of file name.", - "lineNumber": 23, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "filename" - }, - { - "title": "param", - "description": "file extension, either 'jpg' or 'png'.", - "lineNumber": 24, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "extension" - }, - { - "title": "param", - "description": "duration in seconds to record. This parameter will be constrained to be less or equal to 15.", - "lineNumber": 25, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "duration" - }, - { - "title": "param", - "description": "number of frames to save per second. This parameter will be constrained to be less or equal to 22.", - "lineNumber": 26, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "framerate" - }, - { - "title": "param", - "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`.", - "lineNumber": 27, - "type": { - "type": "OptionalType", - "expression": { - "type": "FunctionType", - "params": [ - { - "type": "NameExpression", - "name": "Array" - } - ], - "result": null - } - }, - "name": "callback" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 33 - } - ], - "loc": { - "start": { - "line": 460, - "column": 0, - "index": 13598 - }, - "end": { - "line": 533, - "column": 3, - "index": 16474 - } - }, - "context": { - "loc": { - "start": { - "line": 534, - "column": 0, - "index": 16475 - }, - "end": { - "line": 562, - "column": 2, - "index": 17315 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "filename", - "lineNumber": 23, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "prefix of file name." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "extension", - "lineNumber": 24, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "file extension, either 'jpg' or 'png'." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "duration", - "lineNumber": 25, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "duration in seconds to record. This parameter will be constrained to be less or equal to 15." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "framerate", - "lineNumber": 26, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of frames to save per second. This parameter will be constrained to be less or equal to 22." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 27, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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: " - }, - { - "type": "inlineCode", - "value": "imageData" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "filename" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "extension" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "FunctionType", - "params": [ - { - "type": "NameExpression", - "name": "Array" - } - ], - "result": null - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "saveFrames", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "saveFrames", - "kind": "function" - } - ], - "namespace": "saveFrames" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Loads an image to create a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "loadImage()" - }, - { - "type": "text", - "value": " interprets the first parameter one of three ways. If the path\nto an image file is provided, " - }, - { - "type": "inlineCode", - "value": "loadImage()" - }, - { - "type": "text", - "value": " will load it. Paths to local\nfiles should be relative, such as " - }, - { - "type": "inlineCode", - "value": "'assets/thundercat.jpg'" - }, - { - "type": "text", - "value": ". URLs such as\n" - }, - { - "type": "inlineCode", - "value": "'https://example.com/thundercat.jpg'" - }, - { - "type": "text", - "value": " may be blocked due to browser\nsecurity. Raw image data can also be passed as a base64 encoded image in\nthe form " - }, - { - "type": "inlineCode", - "value": "'data:image/png;base64,arandomsequenceofcharacters'" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Images can take time to load. Calling " - }, - { - "type": "inlineCode", - "value": "loadImage()" - }, - { - "type": "text", - "value": " in\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "preload()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " ensures images load before they're\nused in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 22, - "name": "loadImage" - }, - { - "title": "param", - "description": "path of the image to be loaded or base64 encoded image.", - "lineNumber": 23, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "path" - }, - { - "title": "param", - "description": "function called with\n p5.Image once it\n loads.", - "lineNumber": 24, - "type": { - "type": "OptionalType", - "expression": { - "type": "FunctionType", - "params": [ - { - "type": "NameExpression", - "name": "p5.Image" - } - ], - "result": null - } - }, - "name": "successCallback" - }, - { - "title": "param", - "description": "function called with event\n error if the image fails to load.", - "lineNumber": 27, - "type": { - "type": "OptionalType", - "expression": { - "type": "FunctionType", - "params": [ - { - "type": "NameExpression", - "name": "Event" - } - ], - "result": null - } - }, - "name": "failureCallback" - }, - { - "title": "return", - "description": "the p5.Image object.", - "lineNumber": 29, - "type": { - "type": "NameExpression", - "name": "p5.Image" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 30 - } - ], - "loc": { - "start": { - "line": 18, - "column": 0, - "index": 448 - }, - "end": { - "line": 91, - "column": 3, - "index": 2950 - } - }, - "context": { - "loc": { - "start": { - "line": 92, - "column": 0, - "index": 2951 - }, - "end": { - "line": 201, - "column": 2, - "index": 6301 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/loading_displaying.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "path", - "lineNumber": 23, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "path of the image to be loaded or base64 encoded image." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "successCallback", - "lineNumber": 24, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function called with\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " once it\nloads." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "FunctionType", - "params": [ - { - "type": "NameExpression", - "name": "p5.Image" - } - ], - "result": null - } - } - }, - { - "title": "param", - "name": "failureCallback", - "lineNumber": 27, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function called with event\nerror if the image fails to load." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "FunctionType", - "params": [ - { - "type": "NameExpression", - "name": "Event" - } - ], - "result": null - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Image" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "loadImage", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "loadImage", - "kind": "function" - } - ], - "namespace": "loadImage" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Generates a gif from a sketch and saves it to a file. " - }, - { - "type": "inlineCode", - "value": "saveGif()" - }, - { - "type": "text", - "value": " may be\ncalled in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or at any point while a sketch\nis running." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "fileName" - }, - { - "type": "text", - "value": ", sets the gif's file name. The second\nparameter, " - }, - { - "type": "inlineCode", - "value": "duration" - }, - { - "type": "text", - "value": ", sets the gif's duration in seconds." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The third parameter, " - }, - { - "type": "inlineCode", - "value": "options" - }, - { - "type": "text", - "value": ", is optional. If an object is passed,\n" - }, - { - "type": "inlineCode", - "value": "saveGif()" - }, - { - "type": "text", - "value": " will use its properties to customize the gif. " - }, - { - "type": "inlineCode", - "value": "saveGif()" - }, - { - "type": "text", - "value": "\nrecognizes the properties " - }, - { - "type": "inlineCode", - "value": "delay" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "units" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "silent" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "inlineCode", - "value": "notificationDuration" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "notificationID" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 13, - "name": "saveGif" - }, - { - "title": "param", - "description": "file name of gif.", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "filename" - }, - { - "title": "param", - "description": "duration in seconds to capture from the sketch.", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "duration" - }, - { - "title": "param", - "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’`.", - "lineNumber": 16, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - }, - "name": "options" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 24 - } - ], - "loc": { - "start": { - "line": 203, - "column": 0, - "index": 6303 - }, - "end": { - "line": 246, - "column": 3, - "index": 8149 - } - }, - "context": { - "loc": { - "start": { - "line": 247, - "column": 0, - "index": 8150 - }, - "end": { - "line": 523, - "column": 2, - "index": 16870 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/loading_displaying.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "filename", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "file name of gif." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "duration", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "duration in seconds to capture from the sketch." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "options", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "an object that can contain five more properties:\n" - }, - { - "type": "inlineCode", - "value": "delay" - }, - { - "type": "text", - "value": ", a Number specifying how much time to wait before recording;\n" - }, - { - "type": "inlineCode", - "value": "units" - }, - { - "type": "text", - "value": ", a String that can be either 'seconds' or 'frames'. By default it's 'seconds’;\n" - }, - { - "type": "inlineCode", - "value": "silent" - }, - { - "type": "text", - "value": ", a Boolean that defines presence of progress notifications. By default it’s " - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": ";\n" - }, - { - "type": "inlineCode", - "value": "notificationDuration" - }, - { - "type": "text", - "value": ", a Number that defines how long in seconds the final notification\nwill live. By default it's " - }, - { - "type": "inlineCode", - "value": "0" - }, - { - "type": "text", - "value": ", meaning the notification will never be removed;\n" - }, - { - "type": "inlineCode", - "value": "notificationID" - }, - { - "type": "text", - "value": ", a String that specifies the id of the notification's DOM element. By default it’s " - }, - { - "type": "inlineCode", - "value": "'progressBar’" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "saveGif", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "saveGif", - "kind": "function" - } - ], - "namespace": "saveGif" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Helper function for loading GIF-based images" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 598, - "column": 0, - "index": 19517 - }, - "end": { - "line": 600, - "column": 3, - "index": 19572 - } - }, - "context": { - "loc": { - "start": { - "line": 601, - "column": 0, - "index": 19573 - }, - "end": { - "line": 718, - "column": 1, - "index": 23308 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/loading_displaying.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "arrayBuffer", - "lineNumber": 602 - }, - { - "title": "param", - "name": "pImg", - "lineNumber": 603 - }, - { - "title": "param", - "name": "successCallback", - "lineNumber": 604 - }, - { - "title": "param", - "name": "failureCallback", - "lineNumber": 605 - }, - { - "title": "param", - "name": "finishCallback", - "lineNumber": 606 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "_createGif", - "kind": "function", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "_createGif", - "kind": "function" - } - ], - "namespace": "_createGif" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Draws a source image to the canvas." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "img" - }, - { - "type": "text", - "value": ", is the source image to be drawn. The second and\nthird parameters, " - }, - { - "type": "inlineCode", - "value": "dx" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "dy" - }, - { - "type": "text", - "value": ", set the coordinates of the destination\nimage's top left corner. See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "imageMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for\nother ways to position images." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Here's a diagram that explains how optional parameters work in " - }, - { - "type": "inlineCode", - "value": "image()" - }, - { - "type": "text", - "value": ":" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "html", - "value": "" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The fourth and fifth parameters, " - }, - { - "type": "inlineCode", - "value": "dw" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "dh" - }, - { - "type": "text", - "value": ", are optional. They set the\nthe width and height to draw the destination image. By default, " - }, - { - "type": "inlineCode", - "value": "image()" - }, - { - "type": "text", - "value": "\ndraws the full source image at its original size." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The sixth and seventh parameters, " - }, - { - "type": "inlineCode", - "value": "sx" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "sy" - }, - { - "type": "text", - "value": ", are also optional.\nThese coordinates define the top left corner of a subsection to draw from\nthe source image." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The eighth and ninth parameters, " - }, - { - "type": "inlineCode", - "value": "sw" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "sh" - }, - { - "type": "text", - "value": ", are also optional.\nThey define the width and height of a subsection to draw from the source\nimage. By default, " - }, - { - "type": "inlineCode", - "value": "image()" - }, - { - "type": "text", - "value": " draws the full subsection that begins at\n(" - }, - { - "type": "inlineCode", - "value": "sx" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "sy" - }, - { - "type": "text", - "value": ") and extends to the edges of the source image." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The ninth parameter, " - }, - { - "type": "inlineCode", - "value": "fit" - }, - { - "type": "text", - "value": ", is also optional. It enables a subsection of\nthe source image to be drawn without affecting its aspect ratio. If\n" - }, - { - "type": "inlineCode", - "value": "CONTAIN" - }, - { - "type": "text", - "value": " is passed, the full subsection will appear within the destination\nrectangle. If " - }, - { - "type": "inlineCode", - "value": "COVER" - }, - { - "type": "text", - "value": " is passed, the subsection will completely cover the\ndestination rectangle. This may have the effect of zooming into the\nsubsection." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The tenth and eleventh paremeters, " - }, - { - "type": "inlineCode", - "value": "xAlign" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "yAlign" - }, - { - "type": "text", - "value": ", are also\noptional. They determine how to align the fitted subsection. " - }, - { - "type": "inlineCode", - "value": "xAlign" - }, - { - "type": "text", - "value": " can\nbe set to either " - }, - { - "type": "inlineCode", - "value": "LEFT" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "RIGHT" - }, - { - "type": "text", - "value": ", or " - }, - { - "type": "inlineCode", - "value": "CENTER" - }, - { - "type": "text", - "value": ". " - }, - { - "type": "inlineCode", - "value": "yAlign" - }, - { - "type": "text", - "value": " can be set to\neither " - }, - { - "type": "inlineCode", - "value": "TOP" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "BOTTOM" - }, - { - "type": "text", - "value": ", or " - }, - { - "type": "inlineCode", - "value": "CENTER" - }, - { - "type": "text", - "value": ". By default, both " - }, - { - "type": "inlineCode", - "value": "xAlign" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "yAlign" - }, - { - "type": "text", - "value": "\nare set to " - }, - { - "type": "inlineCode", - "value": "CENTER" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 38, - "name": "image" - }, - { - "title": "param", - "description": "image to display.", - "lineNumber": 39, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Image" - }, - { - "type": "NameExpression", - "name": "p5.Element" - }, - { - "type": "NameExpression", - "name": "p5.Texture" - }, - { - "type": "NameExpression", - "name": "p5.Framebuffer" - }, - { - "type": "NameExpression", - "name": "p5.FramebufferTexture" - } - ] - }, - "name": "img" - }, - { - "title": "param", - "description": "x-coordinate of the top-left corner of the image.", - "lineNumber": 40, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y-coordinate of the top-left corner of the image.", - "lineNumber": 41, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "width to draw the image.", - "lineNumber": 42, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "width" - }, - { - "title": "param", - "description": "height to draw the image.", - "lineNumber": 43, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "height" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 44 - } - ], - "loc": { - "start": { - "line": 847, - "column": 0, - "index": 26273 - }, - "end": { - "line": 994, - "column": 3, - "index": 30629 - } - }, - "context": { - "loc": { - "start": { - "line": 1017, - "column": 0, - "index": 31981 - }, - "end": { - "line": 1111, - "column": 2, - "index": 33939 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/loading_displaying.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "img", - "lineNumber": 39, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "image to display." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Image" - }, - { - "type": "NameExpression", - "name": "p5.Element" - }, - { - "type": "NameExpression", - "name": "p5.Texture" - }, - { - "type": "NameExpression", - "name": "p5.Framebuffer" - }, - { - "type": "NameExpression", - "name": "p5.FramebufferTexture" - } - ] - } - }, - { - "title": "param", - "name": "x", - "lineNumber": 40, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the top-left corner of the image." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 41, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the top-left corner of the image." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "width", - "lineNumber": 42, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "width to draw the image." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "height", - "lineNumber": 43, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "height to draw the image." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "image", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "image", - "kind": "function" - } - ], - "namespace": "image" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "image" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Image" - }, - { - "type": "NameExpression", - "name": "p5.Element" - }, - { - "type": "NameExpression", - "name": "p5.Texture" - }, - { - "type": "NameExpression", - "name": "p5.Framebuffer" - }, - { - "type": "NameExpression", - "name": "p5.FramebufferTexture" - } - ] - }, - "name": "img" - }, - { - "title": "param", - "description": "the x-coordinate of the destination\n rectangle in which to draw the source image", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "dx" - }, - { - "title": "param", - "description": "the y-coordinate of the destination\n rectangle in which to draw the source image", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "dy" - }, - { - "title": "param", - "description": "the width of the destination rectangle", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "dWidth" - }, - { - "title": "param", - "description": "the height of the destination rectangle", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "dHeight" - }, - { - "title": "param", - "description": "the x-coordinate of the subsection of the source\nimage to draw into the destination rectangle", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "sx" - }, - { - "title": "param", - "description": "the y-coordinate of the subsection of the source\nimage to draw into the destination rectangle", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "sy" - }, - { - "title": "param", - "description": "the width of the subsection of the\n source image to draw into the destination\n rectangle", - "lineNumber": 13, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "sWidth" - }, - { - "title": "param", - "description": "the height of the subsection of the\n source image to draw into the destination rectangle", - "lineNumber": 16, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "sHeight" - }, - { - "title": "param", - "description": "either CONTAIN or COVER", - "lineNumber": 18, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "CONTAIN" - }, - { - "type": "NameExpression", - "name": "COVER" - } - ] - } - }, - "name": "fit" - }, - { - "title": "param", - "description": "either LEFT, RIGHT or CENTER default is CENTER", - "lineNumber": 19, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - } - }, - "name": "xAlign", - "default": "CENTER" - }, - { - "title": "param", - "description": "either TOP, BOTTOM or CENTER default is CENTER", - "lineNumber": 20, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "TOP" - }, - { - "type": "NameExpression", - "name": "BOTTOM" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - } - }, - "name": "yAlign", - "default": "CENTER" - } - ], - "loc": { - "start": { - "line": 995, - "column": 0, - "index": 30630 - }, - "end": { - "line": 1016, - "column": 3, - "index": 31980 - } - }, - "context": { - "loc": { - "start": { - "line": 1017, - "column": 0, - "index": 31981 - }, - "end": { - "line": 1111, - "column": 2, - "index": 33939 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/loading_displaying.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "img", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Image" - }, - { - "type": "NameExpression", - "name": "p5.Element" - }, - { - "type": "NameExpression", - "name": "p5.Texture" - }, - { - "type": "NameExpression", - "name": "p5.Framebuffer" - }, - { - "type": "NameExpression", - "name": "p5.FramebufferTexture" - } - ] - } - }, - { - "title": "param", - "name": "dx", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the x-coordinate of the destination\nrectangle in which to draw the source image" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "dy", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the y-coordinate of the destination\nrectangle in which to draw the source image" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "dWidth", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the width of the destination rectangle" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "dHeight", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the height of the destination rectangle" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "sx", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the x-coordinate of the subsection of the source\nimage to draw into the destination rectangle" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "sy", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the y-coordinate of the subsection of the source\nimage to draw into the destination rectangle" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "sWidth", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the width of the subsection of the\nsource image to draw into the destination\nrectangle" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "sHeight", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the height of the subsection of the\nsource image to draw into the destination rectangle" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "fit", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either CONTAIN or COVER" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "CONTAIN" - }, - { - "type": "NameExpression", - "name": "COVER" - } - ] - } - } - }, - { - "title": "param", - "name": "xAlign", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either LEFT, RIGHT or CENTER default is CENTER" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "RIGHT" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - }, - "default": "CENTER" - }, - { - "title": "param", - "name": "yAlign", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either TOP, BOTTOM or CENTER default is CENTER" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "TOP" - }, - { - "type": "NameExpression", - "name": "BOTTOM" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - }, - "default": "CENTER" - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "image", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "image", - "kind": "function" - } - ], - "namespace": "image" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Tints images using a specified color." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "tint()" - }, - { - "type": "text", - "value": " 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" - }, - { - "type": "inlineCode", - "value": "[R, G, B, A]" - }, - { - "type": "text", - "value": " values or a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object can\nalso be used to set the tint color." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "tint()" - }, - { - "type": "text", - "value": " with two parameters uses the first one as a\ngrayscale value and the second as an alpha value. For example, calling\n" - }, - { - "type": "inlineCode", - "value": "tint(255, 128)" - }, - { - "type": "text", - "value": " will make an image 50% transparent." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "tint()" - }, - { - "type": "text", - "value": " with three parameters interprets them as RGB or\nHSB values, depending on the current\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "colorMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". The optional fourth parameter\nsets the alpha value. For example, " - }, - { - "type": "inlineCode", - "value": "tint(255, 0, 0, 100)" - }, - { - "type": "text", - "value": " will give images\na red tint and make them transparent." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 19, - "name": "tint" - }, - { - "title": "param", - "description": "red or hue value.", - "lineNumber": 20, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v1" - }, - { - "title": "param", - "description": "green or saturation value.", - "lineNumber": 21, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v2" - }, - { - "title": "param", - "description": "blue or brightness.", - "lineNumber": 22, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v3" - }, - { - "title": "param", - "description": null, - "lineNumber": 23, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "alpha" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 1113, - "column": 0, - "index": 33941 - }, - "end": { - "line": 1210, - "column": 3, - "index": 36489 - } - }, - "context": { - "loc": { - "start": { - "line": 1232, - "column": 0, - "index": 36919 - }, - "end": { - "line": 1236, - "column": 2, - "index": 37069 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/loading_displaying.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "red or hue value." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 21, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "green or saturation value." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v3", - "lineNumber": 22, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "blue or brightness." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "alpha", - "lineNumber": 23, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "tint", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "tint", - "kind": "function" - } - ], - "namespace": "tint" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "tint" - }, - { - "title": "param", - "description": "CSS color string.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - } - ], - "loc": { - "start": { - "line": 1211, - "column": 0, - "index": 36490 - }, - "end": { - "line": 1214, - "column": 3, - "index": 36566 - } - }, - "context": { - "loc": { - "start": { - "line": 1232, - "column": 0, - "index": 36919 - }, - "end": { - "line": 1236, - "column": 2, - "index": 37069 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/loading_displaying.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "CSS color string." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "tint", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "tint", - "kind": "function" - } - ], - "namespace": "tint" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "tint" - }, - { - "title": "param", - "description": "grayscale value.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "gray" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "alpha" - } - ], - "loc": { - "start": { - "line": 1216, - "column": 0, - "index": 36568 - }, - "end": { - "line": 1220, - "column": 3, - "index": 36677 - } - }, - "context": { - "loc": { - "start": { - "line": 1232, - "column": 0, - "index": 36919 - }, - "end": { - "line": 1236, - "column": 2, - "index": 37069 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/loading_displaying.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "gray", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "grayscale value." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "alpha", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "tint", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "tint", - "kind": "function" - } - ], - "namespace": "tint" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "tint" - }, - { - "title": "param", - "description": "array containing the red, green, blue &\n alpha components of the color.", - "lineNumber": 2, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "values" - } - ], - "loc": { - "start": { - "line": 1222, - "column": 0, - "index": 36679 - }, - "end": { - "line": 1226, - "column": 3, - "index": 36843 - } - }, - "context": { - "loc": { - "start": { - "line": 1232, - "column": 0, - "index": 36919 - }, - "end": { - "line": 1236, - "column": 2, - "index": 37069 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/loading_displaying.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "values", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "array containing the red, green, blue &\nalpha components of the color." - } - ] - } - ] - }, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "tint", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "tint", - "kind": "function" - } - ], - "namespace": "tint" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "tint" - }, - { - "title": "param", - "description": "the tint color", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Color" - }, - "name": "color" - } - ], - "loc": { - "start": { - "line": 1228, - "column": 0, - "index": 36845 - }, - "end": { - "line": 1231, - "column": 3, - "index": 36918 - } - }, - "context": { - "loc": { - "start": { - "line": 1232, - "column": 0, - "index": 36919 - }, - "end": { - "line": 1236, - "column": 2, - "index": 37069 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/loading_displaying.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the tint color" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Color" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "tint", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "tint", - "kind": "function" - } - ], - "namespace": "tint" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes the current tint set by " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "tint()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and restores\nimages to their original colors." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "noTint" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 1238, - "column": 0, - "index": 37071 - }, - "end": { - "line": 1261, - "column": 3, - "index": 37576 - } - }, - "context": { - "loc": { - "start": { - "line": 1262, - "column": 0, - "index": 37577 - }, - "end": { - "line": 1264, - "column": 2, - "index": 37645 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/loading_displaying.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "noTint", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "noTint", - "kind": "function" - } - ], - "namespace": "noTint" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Changes the location from which images are drawn when\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "image()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is called." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "By default, the first\ntwo parameters of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "image()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "inlineCode", - "value": "imageMode(CORNER)" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "imageMode(CORNERS)" - }, - { - "type": "text", - "value": " also uses the first two parameters of\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "image()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "imageMode(CENTER)" - }, - { - "type": "text", - "value": " uses the first two parameters of\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "image()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " as the x- and y-coordinates of the image's\ncenter. The next parameters are its width and height." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 18, - "name": "imageMode" - }, - { - "title": "param", - "description": "either CORNER, CORNERS, or CENTER.", - "lineNumber": 19, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "CORNER" - }, - { - "type": "NameExpression", - "name": "CORNERS" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - }, - "name": "mode" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 20 - } - ], - "loc": { - "start": { - "line": 1277, - "column": 0, - "index": 37933 - }, - "end": { - "line": 1352, - "column": 3, - "index": 39862 - } - }, - "context": { - "loc": { - "start": { - "line": 1353, - "column": 0, - "index": 39863 - }, - "end": { - "line": 1362, - "column": 2, - "index": 40094 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/loading_displaying.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "mode", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either CORNER, CORNERS, or CENTER." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "CORNER" - }, - { - "type": "NameExpression", - "name": "CORNERS" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "imageMode", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "imageMode", - "kind": "function" - } - ], - "namespace": "imageMode" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A class to describe an image. Images are rectangular grids of pixels that\ncan be displayed and modified." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Existing images can be loaded by calling\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadImage()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". Blank images can be created by\ncalling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createImage()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". " - }, - { - "type": "inlineCode", - "value": "p5.Image" - }, - { - "type": "text", - "value": " objects\nhave methods for common tasks such as applying filters and modifying\npixel values." - } - ] - } - ] - }, - "tags": [ - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "class", - "description": null, - "lineNumber": 61, - "type": null, - "name": "p5.Image" - }, - { - "title": "param", - "description": null, - "lineNumber": 62, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "width" - }, - { - "title": "param", - "description": null, - "lineNumber": 63, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "height" - } - ], - "loc": { - "start": { - "line": 22, - "column": 0, - "index": 383 - }, - "end": { - "line": 86, - "column": 3, - "index": 1730 - } - }, - "context": { - "loc": { - "start": { - "line": 87, - "column": 0, - "index": 1731 - }, - "end": { - "line": 1442, - "column": 2, - "index": 39369 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "width", - "lineNumber": 62, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "height", - "lineNumber": 63, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "class", - "name": "p5.Image", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.Image", - "kind": "class" - } - ], - "namespace": "p5.Image" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Image width." - } - ] - } - ] - }, - "tags": [ - { - "title": "type", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "for", - "description": "p5.Image", - "lineNumber": 3 - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "width" - }, - { - "title": "name", - "description": null, - "lineNumber": 5, - "name": "width" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 1444, - "column": 0, - "index": 39371 - }, - "end": { - "line": 1471, - "column": 3, - "index": 39869 - } - }, - "context": { - "loc": { - "start": { - "line": 1573, - "column": 0, - "index": 42565 - }, - "end": { - "line": 1573, - "column": 24, - "index": 42589 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "width", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "width", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "width" - } - ], - "namespace": "width" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Image height." - } - ] - } - ] - }, - "tags": [ - { - "title": "type", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "for", - "description": "p5.Image", - "lineNumber": 3 - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "height" - }, - { - "title": "name", - "description": null, - "lineNumber": 5, - "name": "height" - }, - { - "title": "readOnly", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 1473, - "column": 0, - "index": 39871 - }, - "end": { - "line": 1500, - "column": 3, - "index": 40363 - } - }, - "context": { - "loc": { - "start": { - "line": 1573, - "column": 0, - "index": 42565 - }, - "end": { - "line": 1573, - "column": 24, - "index": 42589 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "height", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "height" - } - ], - "namespace": "height" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An array containing the color of each pixel in the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object. Colors are stored as numbers\nrepresenting red, green, blue, and alpha (RGBA) values. " - }, - { - "type": "inlineCode", - "value": "img.pixels" - }, - { - "type": "text", - "value": " is a\none-dimensional array for performance reasons." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "inlineCode", - "value": "img.pixels[0]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "img.pixels[1]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "img.pixels[2]" - }, - { - "type": "text", - "value": ",\nand " - }, - { - "type": "inlineCode", - "value": "img.pixels[3]" - }, - { - "type": "text", - "value": ", respectively. The next pixel at coordinates (1, 0)\nstores its RGBA values at " - }, - { - "type": "inlineCode", - "value": "img.pixels[4]" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "img.pixels[5]" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "inlineCode", - "value": "img.pixels[6]" - }, - { - "type": "text", - "value": ", and " - }, - { - "type": "inlineCode", - "value": "img.pixels[7]" - }, - { - "type": "text", - "value": ". And so on. The " - }, - { - "type": "inlineCode", - "value": "img.pixels" - }, - { - "type": "text", - "value": " array\nfor a 100×100 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object has\n100 × 100 × 4 = 40,000 elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Accessing the RGBA values for a pixel in the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object requires a little math as\nshown below. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "img.loadPixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nmethod must be called before accessing the " - }, - { - "type": "inlineCode", - "value": "img.pixels" - }, - { - "type": "text", - "value": " array. The\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "img.updatePixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method must be\ncalled after any changes are made." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.Image", - "lineNumber": 22 - }, - { - "title": "property", - "description": null, - "lineNumber": 23, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "pixels" - }, - { - "title": "name", - "description": null, - "lineNumber": 24, - "name": "pixels" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 25 - } - ], - "loc": { - "start": { - "line": 1502, - "column": 0, - "index": 40365 - }, - "end": { - "line": 1571, - "column": 3, - "index": 42563 - } - }, - "context": { - "loc": { - "start": { - "line": 1573, - "column": 0, - "index": 42565 - }, - "end": { - "line": 1573, - "column": 24, - "index": 42589 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/p5.Image.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pixels", - "lineNumber": 23, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "pixels", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "pixels" - } - ], - "namespace": "pixels" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Copies a region of pixels from one image to another. The " - }, - { - "type": "inlineCode", - "value": "blendMode" - }, - { - "type": "text", - "value": "\nparameter blends the images' colors to create different effects." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "blend" - }, - { - "title": "param", - "description": "source image.", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Image" - }, - "name": "srcImage" - }, - { - "title": "param", - "description": "x-coordinate of the source's upper-left corner.", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sx" - }, - { - "title": "param", - "description": "y-coordinate of the source's upper-left corner.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sy" - }, - { - "title": "param", - "description": "source image width.", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sw" - }, - { - "title": "param", - "description": "source image height.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sh" - }, - { - "title": "param", - "description": "x-coordinate of the destination's upper-left corner.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dx" - }, - { - "title": "param", - "description": "y-coordinate of the destination's upper-left corner.", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dy" - }, - { - "title": "param", - "description": "destination image width.", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dw" - }, - { - "title": "param", - "description": "destination image height.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dh" - }, - { - "title": "param", - "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.", - "lineNumber": 14, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "BLEND" - }, - { - "type": "NameExpression", - "name": "DARKEST" - }, - { - "type": "NameExpression", - "name": "LIGHTEST" - }, - { - "type": "NameExpression", - "name": "DIFFERENCE" - }, - { - "type": "NameExpression", - "name": "MULTIPLY" - }, - { - "type": "NameExpression", - "name": "EXCLUSION" - }, - { - "type": "NameExpression", - "name": "SCREEN" - }, - { - "type": "NameExpression", - "name": "REPLACE" - }, - { - "type": "NameExpression", - "name": "OVERLAY" - }, - { - "type": "NameExpression", - "name": "HARD_LIGHT" - }, - { - "type": "NameExpression", - "name": "SOFT_LIGHT" - }, - { - "type": "NameExpression", - "name": "DODGE" - }, - { - "type": "NameExpression", - "name": "BURN" - }, - { - "type": "NameExpression", - "name": "ADD" - }, - { - "type": "NameExpression", - "name": "NORMAL" - } - ] - }, - "name": "blendMode" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 19 - } - ], - "loc": { - "start": { - "line": 106, - "column": 0, - "index": 3059 - }, - "end": { - "line": 185, - "column": 3, - "index": 5507 - } - }, - "context": { - "loc": { - "start": { - "line": 198, - "column": 0, - "index": 5870 - }, - "end": { - "line": 205, - "column": 2, - "index": 6081 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "srcImage", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "source image." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Image" - } - }, - { - "title": "param", - "name": "sx", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the source's upper-left corner." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sy", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the source's upper-left corner." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sw", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "source image width." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sh", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "source image height." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dx", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the destination's upper-left corner." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dy", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the destination's upper-left corner." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dw", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "destination image width." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dh", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "destination image height." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "blendMode", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the blend mode. either\nBLEND, DARKEST, LIGHTEST, DIFFERENCE,\nMULTIPLY, EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT,\nSOFT_LIGHT, DODGE, BURN, ADD or NORMAL." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "BLEND" - }, - { - "type": "NameExpression", - "name": "DARKEST" - }, - { - "type": "NameExpression", - "name": "LIGHTEST" - }, - { - "type": "NameExpression", - "name": "DIFFERENCE" - }, - { - "type": "NameExpression", - "name": "MULTIPLY" - }, - { - "type": "NameExpression", - "name": "EXCLUSION" - }, - { - "type": "NameExpression", - "name": "SCREEN" - }, - { - "type": "NameExpression", - "name": "REPLACE" - }, - { - "type": "NameExpression", - "name": "OVERLAY" - }, - { - "type": "NameExpression", - "name": "HARD_LIGHT" - }, - { - "type": "NameExpression", - "name": "SOFT_LIGHT" - }, - { - "type": "NameExpression", - "name": "DODGE" - }, - { - "type": "NameExpression", - "name": "BURN" - }, - { - "type": "NameExpression", - "name": "ADD" - }, - { - "type": "NameExpression", - "name": "NORMAL" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "blend", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "blend", - "kind": "function" - } - ], - "namespace": "blend" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "blend" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sx" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sy" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sw" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sh" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dx" - }, - { - "title": "param", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dy" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dw" - }, - { - "title": "param", - "description": null, - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dh" - }, - { - "title": "param", - "description": null, - "lineNumber": 10, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "BLEND" - }, - { - "type": "NameExpression", - "name": "DARKEST" - }, - { - "type": "NameExpression", - "name": "LIGHTEST" - }, - { - "type": "NameExpression", - "name": "DIFFERENCE" - }, - { - "type": "NameExpression", - "name": "MULTIPLY" - }, - { - "type": "NameExpression", - "name": "EXCLUSION" - }, - { - "type": "NameExpression", - "name": "SCREEN" - }, - { - "type": "NameExpression", - "name": "REPLACE" - }, - { - "type": "NameExpression", - "name": "OVERLAY" - }, - { - "type": "NameExpression", - "name": "HARD_LIGHT" - }, - { - "type": "NameExpression", - "name": "SOFT_LIGHT" - }, - { - "type": "NameExpression", - "name": "DODGE" - }, - { - "type": "NameExpression", - "name": "BURN" - }, - { - "type": "NameExpression", - "name": "ADD" - }, - { - "type": "NameExpression", - "name": "NORMAL" - } - ] - }, - "name": "blendMode" - } - ], - "loc": { - "start": { - "line": 186, - "column": 0, - "index": 5508 - }, - "end": { - "line": 197, - "column": 3, - "index": 5869 - } - }, - "context": { - "loc": { - "start": { - "line": 198, - "column": 0, - "index": 5870 - }, - "end": { - "line": 205, - "column": 2, - "index": 6081 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "sx", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sy", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sw", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sh", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dx", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dy", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dw", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dh", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "blendMode", - "lineNumber": 10, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "BLEND" - }, - { - "type": "NameExpression", - "name": "DARKEST" - }, - { - "type": "NameExpression", - "name": "LIGHTEST" - }, - { - "type": "NameExpression", - "name": "DIFFERENCE" - }, - { - "type": "NameExpression", - "name": "MULTIPLY" - }, - { - "type": "NameExpression", - "name": "EXCLUSION" - }, - { - "type": "NameExpression", - "name": "SCREEN" - }, - { - "type": "NameExpression", - "name": "REPLACE" - }, - { - "type": "NameExpression", - "name": "OVERLAY" - }, - { - "type": "NameExpression", - "name": "HARD_LIGHT" - }, - { - "type": "NameExpression", - "name": "SOFT_LIGHT" - }, - { - "type": "NameExpression", - "name": "DODGE" - }, - { - "type": "NameExpression", - "name": "BURN" - }, - { - "type": "NameExpression", - "name": "ADD" - }, - { - "type": "NameExpression", - "name": "NORMAL" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "blend", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "blend", - "kind": "function" - } - ], - "namespace": "blend" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Copies pixels from a source image to a region of the canvas. The source\nimage can be the canvas itself or a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nobject. " - }, - { - "type": "inlineCode", - "value": "copy()" - }, - { - "type": "text", - "value": " will scale pixels from the source region if it isn't the\nsame size as the destination region." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "copy" - }, - { - "title": "param", - "description": "source image.", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Image" - }, - { - "type": "NameExpression", - "name": "p5.Element" - } - ] - }, - "name": "srcImage" - }, - { - "title": "param", - "description": "x-coordinate of the source's upper-left corner.", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sx" - }, - { - "title": "param", - "description": "y-coordinate of the source's upper-left corner.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sy" - }, - { - "title": "param", - "description": "source image width.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sw" - }, - { - "title": "param", - "description": "source image height.", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sh" - }, - { - "title": "param", - "description": "x-coordinate of the destination's upper-left corner.", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dx" - }, - { - "title": "param", - "description": "y-coordinate of the destination's upper-left corner.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dy" - }, - { - "title": "param", - "description": "destination image width.", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dw" - }, - { - "title": "param", - "description": "destination image height.", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dh" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 17 - } - ], - "loc": { - "start": { - "line": 207, - "column": 0, - "index": 6083 - }, - "end": { - "line": 245, - "column": 3, - "index": 7402 - } - }, - "context": { - "loc": { - "start": { - "line": 257, - "column": 0, - "index": 7619 - }, - "end": { - "line": 286, - "column": 2, - "index": 8284 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "srcImage", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "source image." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Image" - }, - { - "type": "NameExpression", - "name": "p5.Element" - } - ] - } - }, - { - "title": "param", - "name": "sx", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the source's upper-left corner." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sy", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the source's upper-left corner." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sw", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "source image width." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sh", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "source image height." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dx", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the destination's upper-left corner." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dy", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the destination's upper-left corner." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dw", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "destination image width." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dh", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "destination image height." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "copy", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "copy", - "kind": "function" - } - ], - "namespace": "copy" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "copy" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sx" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sy" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sw" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "sh" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dx" - }, - { - "title": "param", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dy" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dw" - }, - { - "title": "param", - "description": null, - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dh" - } - ], - "loc": { - "start": { - "line": 246, - "column": 0, - "index": 7403 - }, - "end": { - "line": 256, - "column": 3, - "index": 7618 - } - }, - "context": { - "loc": { - "start": { - "line": 257, - "column": 0, - "index": 7619 - }, - "end": { - "line": 286, - "column": 2, - "index": 8284 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "sx", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sy", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sw", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "sh", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dx", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dy", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dw", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dh", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "copy", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "copy", - "kind": "function" - } - ], - "namespace": "copy" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Applies an image filter to the canvas. The preset options are:" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "INVERT" - }, - { - "type": "text", - "value": "\nInverts the colors in the image. No parameter is used." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "GRAY" - }, - { - "type": "text", - "value": "\nConverts the image to grayscale. No parameter is used." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "THRESHOLD" - }, - { - "type": "text", - "value": "\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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "OPAQUE" - }, - { - "type": "text", - "value": "\nSets the alpha channel to entirely opaque. No parameter is used." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "POSTERIZE" - }, - { - "type": "text", - "value": "\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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "BLUR" - }, - { - "type": "text", - "value": "\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 " - }, - { - "type": "inlineCode", - "value": "P2D" - }, - { - "type": "text", - "value": " mode. A box blur is used in " - }, - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " mode." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "ERODE" - }, - { - "type": "text", - "value": "\nReduces the light areas. No parameter is used." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "DILATE" - }, - { - "type": "text", - "value": "\nIncreases the light areas. No parameter is used." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "filter()" - }, - { - "type": "text", - "value": " uses WebGL in the background by default because it's faster.\nThis can be disabled in " - }, - { - "type": "inlineCode", - "value": "P2D" - }, - { - "type": "text", - "value": " mode by adding a " - }, - { - "type": "inlineCode", - "value": "false" - }, - { - "type": "text", - "value": " argument, as in\n" - }, - { - "type": "inlineCode", - "value": "filter(BLUR, false)" - }, - { - "type": "text", - "value": ". This may be useful to keep computation off the GPU\nor to work around a lack of WebGL support." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "In " - }, - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " mode, " - }, - { - "type": "inlineCode", - "value": "filter()" - }, - { - "type": "text", - "value": " can also use custom shaders. See\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createFilterShader()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for more\ninformation." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 44, - "name": "filter" - }, - { - "title": "param", - "description": "either THRESHOLD, GRAY, OPAQUE, INVERT,\n POSTERIZE, BLUR, ERODE, DILATE or BLUR.", - "lineNumber": 45, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "THRESHOLD" - }, - { - "type": "NameExpression", - "name": "GRAY" - }, - { - "type": "NameExpression", - "name": "OPAQUE" - }, - { - "type": "NameExpression", - "name": "INVERT" - }, - { - "type": "NameExpression", - "name": "POSTERIZE" - }, - { - "type": "NameExpression", - "name": "BLUR" - }, - { - "type": "NameExpression", - "name": "ERODE" - }, - { - "type": "NameExpression", - "name": "DILATE" - }, - { - "type": "NameExpression", - "name": "BLUR" - } - ] - }, - "name": "filterType" - }, - { - "title": "param", - "description": "parameter unique to each filter.", - "lineNumber": 47, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "filterParam" - }, - { - "title": "param", - "description": "flag to control whether to use fast\n WebGL filters (GPU) or original image\n filters (CPU); defaults to `true`.", - "lineNumber": 48, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - }, - "name": "useWebGL", - "default": "true" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 52 - } - ], - "loc": { - "start": { - "line": 343, - "column": 0, - "index": 9307 - }, - "end": { - "line": 549, - "column": 3, - "index": 13854 - } - }, - "context": { - "loc": { - "start": { - "line": 556, - "column": 0, - "index": 13936 - }, - "end": { - "line": 558, - "column": 2, - "index": 14039 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "filterType", - "lineNumber": 45, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either THRESHOLD, GRAY, OPAQUE, INVERT,\nPOSTERIZE, BLUR, ERODE, DILATE or BLUR." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "THRESHOLD" - }, - { - "type": "NameExpression", - "name": "GRAY" - }, - { - "type": "NameExpression", - "name": "OPAQUE" - }, - { - "type": "NameExpression", - "name": "INVERT" - }, - { - "type": "NameExpression", - "name": "POSTERIZE" - }, - { - "type": "NameExpression", - "name": "BLUR" - }, - { - "type": "NameExpression", - "name": "ERODE" - }, - { - "type": "NameExpression", - "name": "DILATE" - }, - { - "type": "NameExpression", - "name": "BLUR" - } - ] - } - }, - { - "title": "param", - "name": "filterParam", - "lineNumber": 47, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "parameter unique to each filter." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "useWebGL", - "lineNumber": 48, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "flag to control whether to use fast\nWebGL filters (GPU) or original image\nfilters (CPU); defaults to " - }, - { - "type": "inlineCode", - "value": "true" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "default": "true" - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "filter", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "filter", - "kind": "function" - } - ], - "namespace": "filter" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "filter" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "THRESHOLD" - }, - { - "type": "NameExpression", - "name": "GRAY" - }, - { - "type": "NameExpression", - "name": "OPAQUE" - }, - { - "type": "NameExpression", - "name": "INVERT" - }, - { - "type": "NameExpression", - "name": "POSTERIZE" - }, - { - "type": "NameExpression", - "name": "BLUR" - }, - { - "type": "NameExpression", - "name": "ERODE" - }, - { - "type": "NameExpression", - "name": "DILATE" - }, - { - "type": "NameExpression", - "name": "BLUR" - } - ] - }, - "name": "filterType" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "filterParam" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - }, - "name": "useWebGL", - "default": "true" - } - ], - "loc": { - "start": { - "line": 560, - "column": 0, - "index": 14041 - }, - "end": { - "line": 565, - "column": 3, - "index": 14225 - } - }, - "context": { - "loc": { - "start": { - "line": 571, - "column": 0, - "index": 14398 - }, - "end": { - "line": 633, - "column": 2, - "index": 16231 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "filterType", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "THRESHOLD" - }, - { - "type": "NameExpression", - "name": "GRAY" - }, - { - "type": "NameExpression", - "name": "OPAQUE" - }, - { - "type": "NameExpression", - "name": "INVERT" - }, - { - "type": "NameExpression", - "name": "POSTERIZE" - }, - { - "type": "NameExpression", - "name": "BLUR" - }, - { - "type": "NameExpression", - "name": "ERODE" - }, - { - "type": "NameExpression", - "name": "DILATE" - }, - { - "type": "NameExpression", - "name": "BLUR" - } - ] - } - }, - { - "title": "param", - "name": "filterParam", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "useWebGL", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "default": "true" - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "filter", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "filter", - "kind": "function" - } - ], - "namespace": "filter" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "filter" - }, - { - "title": "param", - "description": "shader that's been loaded, with the\n frag shader using a `tex0` uniform.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Shader" - }, - "name": "shaderFilter" - } - ], - "loc": { - "start": { - "line": 566, - "column": 0, - "index": 14226 - }, - "end": { - "line": 570, - "column": 3, - "index": 14397 - } - }, - "context": { - "loc": { - "start": { - "line": 571, - "column": 0, - "index": 14398 - }, - "end": { - "line": 633, - "column": 2, - "index": 16231 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "shaderFilter", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "shader that's been loaded, with the\nfrag shader using a " - }, - { - "type": "inlineCode", - "value": "tex0" - }, - { - "type": "text", - "value": " uniform." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Shader" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "filter", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "filter", - "kind": "function" - } - ], - "namespace": "filter" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Gets a pixel or a region of pixels from the canvas." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "get()" - }, - { - "type": "text", - "value": " is easy to use but it's not as fast as\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixels" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixels" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nto read many pixel values." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "get()" - }, - { - "type": "text", - "value": " with no parameters returns the entire canvas." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "get()" - }, - { - "type": "text", - "value": " with two parameters interprets them as\ncoordinates. It returns an array with the " - }, - { - "type": "inlineCode", - "value": "[R, G, B, A]" - }, - { - "type": "text", - "value": " values of the\npixel at the given point." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "get()" - }, - { - "type": "text", - "value": " with four parameters interprets them as coordinates\nand dimensions. It returns a subsection of the canvas as a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image.get()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to work directly with\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " objects." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 22, - "name": "get" - }, - { - "title": "param", - "description": "x-coordinate of the pixel.", - "lineNumber": 23, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y-coordinate of the pixel.", - "lineNumber": 24, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "width of the subsection to be returned.", - "lineNumber": 25, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "w" - }, - { - "title": "param", - "description": "height of the subsection to be returned.", - "lineNumber": 26, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "h" - }, - { - "title": "return", - "description": "subsection as a p5.Image object.", - "lineNumber": 27, - "type": { - "type": "NameExpression", - "name": "p5.Image" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 28 - } - ], - "loc": { - "start": { - "line": 666, - "column": 0, - "index": 16799 - }, - "end": { - "line": 750, - "column": 3, - "index": 19119 - } - }, - "context": { - "loc": { - "start": { - "line": 761, - "column": 0, - "index": 19392 - }, - "end": { - "line": 764, - "column": 2, - "index": 19523 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 23, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the pixel." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 24, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the pixel." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "w", - "lineNumber": 25, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "width of the subsection to be returned." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "h", - "lineNumber": 26, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "height of the subsection to be returned." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "subsection as a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Image" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "get", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "get", - "kind": "function" - } - ], - "namespace": "get" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "get" - }, - { - "title": "return", - "description": "whole canvas as a p5.Image.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Image" - } - } - ], - "loc": { - "start": { - "line": 751, - "column": 0, - "index": 19120 - }, - "end": { - "line": 754, - "column": 3, - "index": 19222 - } - }, - "context": { - "loc": { - "start": { - "line": 761, - "column": 0, - "index": 19392 - }, - "end": { - "line": 764, - "column": 2, - "index": 19523 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "whole canvas as a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Image" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "get", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "get", - "kind": "function" - } - ], - "namespace": "get" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "get" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "return", - "description": "color of the pixel at (x, y) in array format `[R, G, B, A]`.", - "lineNumber": 4, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "loc": { - "start": { - "line": 755, - "column": 0, - "index": 19223 - }, - "end": { - "line": 760, - "column": 3, - "index": 19391 - } - }, - "context": { - "loc": { - "start": { - "line": 761, - "column": 0, - "index": 19392 - }, - "end": { - "line": 764, - "column": 2, - "index": 19523 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "color of the pixel at (x, y) in array format " - }, - { - "type": "inlineCode", - "value": "[R, G, B, A]" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "get", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "get", - "kind": "function" - } - ], - "namespace": "get" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves a value from the TableRow's specified column.\nThe column may be specified by either its ID or title." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "get" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 5, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": null, - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 184, - "column": 2, - "index": 4952 - }, - "end": { - "line": 222, - "column": 3, - "index": 5934 - } - }, - "context": { - "loc": { - "start": { - "line": 223, - "column": 2, - "index": 5937 - }, - "end": { - "line": 229, - "column": 3, - "index": 6073 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.TableRow.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "column", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "get", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "get", - "kind": "function" - } - ], - "namespace": "get" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Loads the current value of each pixel on the canvas into the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixels" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " array. This\nfunction must be called before reading from or writing to\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixels" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "loadPixels" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 766, - "column": 0, - "index": 19525 - }, - "end": { - "line": 796, - "column": 3, - "index": 20287 - } - }, - "context": { - "loc": { - "start": { - "line": 797, - "column": 0, - "index": 20288 - }, - "end": { - "line": 800, - "column": 2, - "index": 20413 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "loadPixels", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "loadPixels", - "kind": "function" - } - ], - "namespace": "loadPixels" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the color of a pixel or draws an image to the canvas." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "set()" - }, - { - "type": "text", - "value": " is easy to use but it's not as fast as\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixels" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixels" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nto set many pixel values." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "set()" - }, - { - "type": "text", - "value": " interprets the first two parameters as x- and y-coordinates. It\ninterprets the last parameter as a grayscale value, a " - }, - { - "type": "inlineCode", - "value": "[R, G, B, A]" - }, - { - "type": "text", - "value": " pixel\narray, a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object, or a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object. If an image is passed, the first\ntwo parameters set the coordinates for the image's upper-left corner,\nregardless of the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "imageMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "updatePixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " must be called after using\n" - }, - { - "type": "inlineCode", - "value": "set()" - }, - { - "type": "text", - "value": " for changes to appear." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 17, - "name": "set" - }, - { - "title": "param", - "description": "x-coordinate of the pixel.", - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y-coordinate of the pixel.", - "lineNumber": 19, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "grayscale value | pixel array |\n p5.Color object | p5.Image to copy.", - "lineNumber": 20, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "Object" - } - ] - }, - "name": "c" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 802, - "column": 0, - "index": 20415 - }, - "end": { - "line": 880, - "column": 3, - "index": 22559 - } - }, - "context": { - "loc": { - "start": { - "line": 881, - "column": 0, - "index": 22560 - }, - "end": { - "line": 883, - "column": 2, - "index": 22646 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the pixel." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the pixel." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "c", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "grayscale value | pixel array |\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object | " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to copy." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "Object" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "set", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "set", - "kind": "function" - } - ], - "namespace": "set" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Stores a value in the TableRow's specified column.\nThe column may be specified by either its ID or title." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "set" - }, - { - "title": "param", - "description": "Column ID (Number)\n or Title (String)", - "lineNumber": 5, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "The value to be stored", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 36, - "column": 2, - "index": 838 - }, - "end": { - "line": 74, - "column": 3, - "index": 1856 - } - }, - "context": { - "loc": { - "start": { - "line": 75, - "column": 2, - "index": 1859 - }, - "end": { - "line": 95, - "column": 3, - "index": 2555 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.TableRow.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "column", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (Number)\nor Title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to be stored" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "set", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "set", - "kind": "function" - } - ], - "namespace": "set" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Updates the canvas with the RGBA values in the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixels" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " array." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "updatePixels()" - }, - { - "type": "text", - "value": " only needs to be called after changing values in the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pixels" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " array. Such changes can be made directly\nafter calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadPixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or by calling\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "set()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "updatePixels" - }, - { - "title": "param", - "description": "x-coordinate of the upper-left corner of region\n to update.", - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "x" - }, - { - "title": "param", - "description": "y-coordinate of the upper-left corner of region\n to update.", - "lineNumber": 12, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "y" - }, - { - "title": "param", - "description": "width of region to update.", - "lineNumber": 14, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "w" - }, - { - "title": "param", - "description": "height of region to update.", - "lineNumber": 15, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "h" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 16 - } - ], - "loc": { - "start": { - "line": 885, - "column": 0, - "index": 22648 - }, - "end": { - "line": 924, - "column": 3, - "index": 23890 - } - }, - "context": { - "loc": { - "start": { - "line": 925, - "column": 0, - "index": 23891 - }, - "end": { - "line": 933, - "column": 2, - "index": 24219 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/image/pixels.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the upper-left corner of region\nto update." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the upper-left corner of region\nto update." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "w", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "width of region to update." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "h", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "height of region to update." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "updatePixels", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "updatePixels", - "kind": "function" - } - ], - "namespace": "updatePixels" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "IO" - }, - { - "title": "submodule", - "description": "Input", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 70 - } - }, - "context": { - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 72 - }, - "end": { - "line": 8, - "column": 30, - "index": 102 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "IO", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "IO", - "kind": "module" - } - ], - "namespace": "IO" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "IO" - }, - { - "title": "submodule", - "description": "Output", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 1102, - "column": 0, - "index": 33608 - }, - "end": { - "line": 1106, - "column": 3, - "index": 33661 - } - }, - "context": { - "loc": { - "start": { - "line": 1108, - "column": 0, - "index": 33663 - }, - "end": { - "line": 1108, - "column": 44, - "index": 33707 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "IO", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "IO", - "kind": "module" - } - ], - "namespace": "IO" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "IO" - }, - { - "title": "submodule", - "description": "Output", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 1342, - "column": 0, - "index": 39934 - }, - "end": { - "line": 1346, - "column": 3, - "index": 39987 - } - }, - "context": { - "loc": { - "start": { - "line": 1448, - "column": 0, - "index": 43988 - }, - "end": { - "line": 1493, - "column": 2, - "index": 45837 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "IO", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "IO", - "kind": "module" - } - ], - "namespace": "IO" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "IO" - }, - { - "title": "submodule", - "description": "Table", - "lineNumber": 2 - }, - { - "title": "requires", - "description": null, - "lineNumber": 3, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 5, - "column": 3, - "index": 59 - } - }, - "context": { - "loc": { - "start": { - "line": 7, - "column": 0, - "index": 61 - }, - "end": { - "line": 7, - "column": 30, - "index": 91 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "IO", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "IO", - "kind": "module" - } - ], - "namespace": "IO" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "IO" - }, - { - "title": "submodule", - "description": "Table", - "lineNumber": 2 - }, - { - "title": "requires", - "description": null, - "lineNumber": 3, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 5, - "column": 3, - "index": 59 - } - }, - "context": { - "loc": { - "start": { - "line": 7, - "column": 0, - "index": 61 - }, - "end": { - "line": 7, - "column": 30, - "index": 91 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.TableRow.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "IO", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "IO", - "kind": "module" - } - ], - "namespace": "IO" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "IO" - }, - { - "title": "submodule", - "description": "Input", - "lineNumber": 2 - }, - { - "title": "requires", - "description": null, - "lineNumber": 3, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 5, - "column": 3, - "index": 59 - } - }, - "context": { - "loc": { - "start": { - "line": 7, - "column": 0, - "index": 61 - }, - "end": { - "line": 7, - "column": 30, - "index": 91 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.XML.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "IO", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "IO", - "kind": "module" - } - ], - "namespace": "IO" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "IO" - }, - { - "title": "submodule", - "description": "Time & Date", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 76 - } - }, - "context": { - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 78 - }, - "end": { - "line": 8, - "column": 30, - "index": 108 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/time_date.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "IO", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "IO", - "kind": "module" - } - ], - "namespace": "IO" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "here" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This method is suitable for fetching files up to size of 64MB." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 12, - "name": "loadJSON" - }, - { - "title": "param", - "description": "name of the file or url to load", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "path" - }, - { - "title": "param", - "description": "options object for jsonp related settings", - "lineNumber": 14, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - }, - "name": "jsonpOptions" - }, - { - "title": "param", - "description": "\"json\" or \"jsonp\"", - "lineNumber": 15, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "datatype" - }, - { - "title": "param", - "description": "function to be executed after\n loadJSON() completes, data is passed\n in as first argument", - "lineNumber": 16, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "callback" - }, - { - "title": "param", - "description": "function to be executed if\n there is an error, response is passed\n in as first argument", - "lineNumber": 19, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "errorCallback" - }, - { - "title": "return", - "description": "JSON data", - "lineNumber": 22, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "Array" - } - ] - } - }, - { - "title": "example", - "description": "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
", - "lineNumber": 23 - } - ], - "loc": { - "start": { - "line": 15, - "column": 0, - "index": 328 - }, - "end": { - "line": 98, - "column": 3, - "index": 3693 - } - }, - "context": { - "loc": { - "start": { - "line": 114, - "column": 0, - "index": 4062 - }, - "end": { - "line": 169, - "column": 2, - "index": 5122 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [ - { - "description": "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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "path", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "name of the file or url to load" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "jsonpOptions", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "options object for jsonp related settings" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - } - }, - { - "title": "param", - "name": "datatype", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "\"json\" or \"jsonp\"" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to be executed after\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadJSON()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " completes, data is passed\nin as first argument" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - }, - { - "title": "param", - "name": "errorCallback", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to be executed if\nthere is an error, response is passed\nin as first argument" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "JSON data" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "Array" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "loadJSON", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "loadJSON", - "kind": "function" - } - ], - "namespace": "loadJSON" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "loadJSON" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "path" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "datatype" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "callback" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "errorCallback" - }, - { - "title": "return", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "Array" - } - ] - } - } - ], - "loc": { - "start": { - "line": 99, - "column": 0, - "index": 3694 - }, - "end": { - "line": 106, - "column": 3, - "index": 3896 - } - }, - "context": { - "loc": { - "start": { - "line": 114, - "column": 0, - "index": 4062 - }, - "end": { - "line": 169, - "column": 2, - "index": 5122 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "path", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "datatype", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - }, - { - "title": "param", - "name": "errorCallback", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "Array" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "loadJSON", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "loadJSON", - "kind": "function" - } - ], - "namespace": "loadJSON" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "loadJSON" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "path" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "function" - }, - "name": "callback" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "errorCallback" - }, - { - "title": "return", - "description": null, - "lineNumber": 5, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "Array" - } - ] - } - } - ], - "loc": { - "start": { - "line": 107, - "column": 0, - "index": 3897 - }, - "end": { - "line": 113, - "column": 3, - "index": 4061 - } - }, - "context": { - "loc": { - "start": { - "line": 114, - "column": 0, - "index": 4062 - }, - "end": { - "line": 169, - "column": 2, - "index": 5122 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "path", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "function" - } - }, - { - "title": "param", - "name": "errorCallback", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "Array" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "loadJSON", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "loadJSON", - "kind": "function" - } - ], - "namespace": "loadJSON" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This method is asynchronous, meaning it may not finish before the next\nline in your sketch is executed." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This method is suitable for fetching files up to size of 64MB." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 14, - "name": "loadStrings" - }, - { - "title": "param", - "description": "name of the file or url to load", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "filename" - }, - { - "title": "param", - "description": "function to be executed after loadStrings()\n completes, Array is passed in as first\n argument", - "lineNumber": 16, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "callback" - }, - { - "title": "param", - "description": "function to be executed if\n there is an error, response is passed\n in as first argument", - "lineNumber": 19, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "errorCallback" - }, - { - "title": "return", - "description": "Array of Strings", - "lineNumber": 22, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "example", - "description": "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
", - "lineNumber": 23 - } - ], - "loc": { - "start": { - "line": 171, - "column": 0, - "index": 5124 - }, - "end": { - "line": 228, - "column": 3, - "index": 7271 - } - }, - "context": { - "loc": { - "start": { - "line": 229, - "column": 0, - "index": 7272 - }, - "end": { - "line": 289, - "column": 2, - "index": 8794 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [ - { - "description": "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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "filename", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "name of the file or url to load" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to be executed after " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadStrings()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ncompletes, Array is passed in as first\nargument" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - }, - { - "title": "param", - "name": "errorCallback", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to be executed if\nthere is an error, response is passed\nin as first argument" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of Strings" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "loadStrings", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "loadStrings", - "kind": "function" - } - ], - "namespace": "loadStrings" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reads the contents of a file or URL and creates a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This method is asynchronous, meaning it may not finish before the next\nline in your sketch is executed. Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadTable()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " inside " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "preload()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nguarantees to complete the operation before " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " are called.\nOutside of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "preload()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", you may supply a callback function to handle the\nobject:" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "All files loaded and saved use UTF-8 encoding. This method is suitable for fetching files up to size of 64MB." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 15, - "name": "loadTable" - }, - { - "title": "param", - "description": "name of the file or URL to load", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "filename" - }, - { - "title": "param", - "description": "parse the table by comma-separated values \"csv\", semicolon-separated\n values \"ssv\", or tab-separated values \"tsv\"", - "lineNumber": 17, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "extension" - }, - { - "title": "param", - "description": "\"header\" to indicate table has header row", - "lineNumber": 19, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "header" - }, - { - "title": "param", - "description": "function to be executed after\n loadTable() completes. On success, the\n Table object is passed in as the\n first argument.", - "lineNumber": 20, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "callback" - }, - { - "title": "param", - "description": "function to be executed if\n there is an error, response is passed\n in as first argument", - "lineNumber": 24, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "errorCallback" - }, - { - "title": "return", - "description": "Table object containing data", - "lineNumber": 27, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 29 - } - ], - "loc": { - "start": { - "line": 291, - "column": 0, - "index": 8796 - }, - "end": { - "line": 360, - "column": 3, - "index": 11957 - } - }, - "context": { - "loc": { - "start": { - "line": 361, - "column": 0, - "index": 11958 - }, - "end": { - "line": 550, - "column": 2, - "index": 16569 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "filename", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "name of the file or URL to load" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "extension", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "parse the table by comma-separated values \"csv\", semicolon-separated\nvalues \"ssv\", or tab-separated values \"tsv\"" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - }, - { - "title": "param", - "name": "header", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "\"header\" to indicate table has header row" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to be executed after\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadTable()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " completes. On success, the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object is passed in as the\nfirst argument." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - }, - { - "title": "param", - "name": "errorCallback", - "lineNumber": 24, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to be executed if\nthere is an error, response is passed\nin as first argument" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object containing data" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "loadTable", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "loadTable", - "kind": "function" - } - ], - "namespace": "loadTable" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This method is asynchronous, meaning it may not finish before the next\nline in your sketch is executed. Calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadXML()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " inside " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "preload()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nguarantees to complete the operation before " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " are called." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Outside of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "preload()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", you may supply a callback function to handle the\nobject." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This method is suitable for fetching files up to size of 64MB." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 18, - "name": "loadXML" - }, - { - "title": "param", - "description": "name of the file or URL to load", - "lineNumber": 19, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "filename" - }, - { - "title": "param", - "description": "function to be executed after loadXML()\n completes, XML object is passed in as\n first argument", - "lineNumber": 20, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "callback" - }, - { - "title": "param", - "description": "function to be executed if\n there is an error, response is passed\n in as first argument", - "lineNumber": 23, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "errorCallback" - }, - { - "title": "return", - "description": "XML object containing data", - "lineNumber": 26, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 566, - "column": 0, - "index": 16898 - }, - "end": { - "line": 628, - "column": 3, - "index": 19460 - } - }, - "context": { - "loc": { - "start": { - "line": 629, - "column": 0, - "index": 19461 - }, - "end": { - "line": 672, - "column": 2, - "index": 20330 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "filename", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "name of the file or URL to load" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to be executed after " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadXML()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ncompletes, XML object is passed in as\nfirst argument" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - }, - { - "title": "param", - "name": "errorCallback", - "lineNumber": 23, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to be executed if\nthere is an error, response is passed\nin as first argument" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "XML object containing data" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "loadXML", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "loadXML", - "kind": "function" - } - ], - "namespace": "loadXML" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This method is suitable for fetching files up to size of 64MB." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 2, - "name": "loadBytes" - }, - { - "title": "param", - "description": "name of the file or URL to load", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "string" - }, - "name": "file" - }, - { - "title": "param", - "description": "function to be executed after loadBytes()\n completes", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "callback" - }, - { - "title": "param", - "description": "function to be executed if there\n is an error", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "errorCallback" - }, - { - "title": "returns", - "description": "an object whose 'bytes' property will be the loaded buffer", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 674, - "column": 0, - "index": 20332 - }, - "end": { - "line": 699, - "column": 3, - "index": 21162 - } - }, - "context": { - "loc": { - "start": { - "line": 700, - "column": 0, - "index": 21163 - }, - "end": { - "line": 729, - "column": 2, - "index": 21713 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "file", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "name of the file or URL to load" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "string" - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to be executed after " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadBytes()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ncompletes" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - }, - { - "title": "param", - "name": "errorCallback", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to be executed if there\nis an error" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "an object whose 'bytes' property will be the loaded buffer" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "loadBytes", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "loadBytes", - "kind": "function" - } - ], - "namespace": "loadBytes" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "httpDo(path, 'GET')" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". 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)." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 7, - "name": "httpGet" - }, - { - "title": "param", - "description": "name of the file or url to load", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "path" - }, - { - "title": "param", - "description": "\"json\", \"jsonp\", \"binary\", \"arrayBuffer\",\n \"xml\", or \"text\"", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "datatype" - }, - { - "title": "param", - "description": "param data passed sent with request", - "lineNumber": 11, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - }, - "name": "data" - }, - { - "title": "param", - "description": "function to be executed after\n httpGet() completes, data is passed in\n as first argument", - "lineNumber": 12, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "callback" - }, - { - "title": "param", - "description": "function to be executed if\n there is an error, response is passed\n in as first argument", - "lineNumber": 15, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "errorCallback" - }, - { - "title": "return", - "description": "A promise that resolves with the data when the operation\n completes successfully or rejects with the error after\n one occurs.", - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "Promise" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 21 - } - ], - "loc": { - "start": { - "line": 731, - "column": 0, - "index": 21715 - }, - "end": { - "line": 784, - "column": 3, - "index": 24177 - } - }, - "context": { - "loc": { - "start": { - "line": 800, - "column": 0, - "index": 24531 - }, - "end": { - "line": 806, - "column": 2, - "index": 24748 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "path", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "name of the file or url to load" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "datatype", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "\"json\", \"jsonp\", \"binary\", \"arrayBuffer\",\n\"xml\", or \"text\"" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - }, - { - "title": "param", - "name": "data", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "param data passed sent with request" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to be executed after\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "httpGet()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " completes, data is passed in\nas first argument" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - }, - { - "title": "param", - "name": "errorCallback", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to be executed if\nthere is an error, response is passed\nin as first argument" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A promise that resolves with the data when the operation\ncompletes successfully or rejects with the error after\none occurs." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Promise" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "httpGet", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "httpGet", - "kind": "function" - } - ], - "namespace": "httpGet" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "httpGet" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "path" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - }, - "name": "data" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "callback" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "errorCallback" - }, - { - "title": "return", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Promise" - } - } - ], - "loc": { - "start": { - "line": 785, - "column": 0, - "index": 24178 - }, - "end": { - "line": 792, - "column": 3, - "index": 24371 - } - }, - "context": { - "loc": { - "start": { - "line": 800, - "column": 0, - "index": 24531 - }, - "end": { - "line": 806, - "column": 2, - "index": 24748 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "path", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "data", - "lineNumber": 3, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - }, - { - "title": "param", - "name": "errorCallback", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Promise" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "httpGet", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "httpGet", - "kind": "function" - } - ], - "namespace": "httpGet" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "httpGet" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "path" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "function" - }, - "name": "callback" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "errorCallback" - }, - { - "title": "return", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Promise" - } - } - ], - "loc": { - "start": { - "line": 793, - "column": 0, - "index": 24372 - }, - "end": { - "line": 799, - "column": 3, - "index": 24530 - } - }, - "context": { - "loc": { - "start": { - "line": 800, - "column": 0, - "index": 24531 - }, - "end": { - "line": 806, - "column": 2, - "index": 24748 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "path", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "function" - } - }, - { - "title": "param", - "name": "errorCallback", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Promise" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "httpGet", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "httpGet", - "kind": "function" - } - ], - "namespace": "httpGet" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "httpDo(path, 'POST')" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "httpPost" - }, - { - "title": "param", - "description": "name of the file or url to load", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "path" - }, - { - "title": "param", - "description": "\"json\", \"jsonp\", \"xml\", or \"text\".\n If omitted, httpPost() will guess.", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "datatype" - }, - { - "title": "param", - "description": "param data passed sent with request", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - }, - "name": "data" - }, - { - "title": "param", - "description": "function to be executed after\n httpPost() completes, data is passed in\n as first argument", - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "callback" - }, - { - "title": "param", - "description": "function to be executed if\n there is an error, response is passed\n in as first argument", - "lineNumber": 13, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "errorCallback" - }, - { - "title": "return", - "description": "A promise that resolves with the data when the operation\n completes successfully or rejects with the error after\n one occurs.", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Promise" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 20 - } - ], - "loc": { - "start": { - "line": 808, - "column": 0, - "index": 24750 - }, - "end": { - "line": 874, - "column": 3, - "index": 26985 - } - }, - "context": { - "loc": { - "start": { - "line": 890, - "column": 0, - "index": 27341 - }, - "end": { - "line": 896, - "column": 2, - "index": 27561 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "path", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "name of the file or url to load" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "datatype", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "\"json\", \"jsonp\", \"xml\", or \"text\".\nIf omitted, " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "httpPost()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " will guess." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - }, - { - "title": "param", - "name": "data", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "param data passed sent with request" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to be executed after\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "httpPost()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " completes, data is passed in\nas first argument" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - }, - { - "title": "param", - "name": "errorCallback", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to be executed if\nthere is an error, response is passed\nin as first argument" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A promise that resolves with the data when the operation\ncompletes successfully or rejects with the error after\none occurs." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Promise" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "httpPost", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "httpPost", - "kind": "function" - } - ], - "namespace": "httpPost" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "httpPost" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "path" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - }, - "name": "data" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "callback" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "errorCallback" - }, - { - "title": "return", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Promise" - } - } - ], - "loc": { - "start": { - "line": 875, - "column": 0, - "index": 26986 - }, - "end": { - "line": 882, - "column": 3, - "index": 27180 - } - }, - "context": { - "loc": { - "start": { - "line": 890, - "column": 0, - "index": 27341 - }, - "end": { - "line": 896, - "column": 2, - "index": 27561 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "path", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "data", - "lineNumber": 3, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - }, - { - "title": "param", - "name": "errorCallback", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Promise" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "httpPost", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "httpPost", - "kind": "function" - } - ], - "namespace": "httpPost" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "httpPost" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "path" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "function" - }, - "name": "callback" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "errorCallback" - }, - { - "title": "return", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Promise" - } - } - ], - "loc": { - "start": { - "line": 883, - "column": 0, - "index": 27181 - }, - "end": { - "line": 889, - "column": 3, - "index": 27340 - } - }, - "context": { - "loc": { - "start": { - "line": 890, - "column": 0, - "index": 27341 - }, - "end": { - "line": 896, - "column": 2, - "index": 27561 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "path", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "function" - } - }, - { - "title": "param", - "name": "errorCallback", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Promise" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "httpPost", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "httpPost", - "kind": "function" - } - ], - "namespace": "httpPost" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Method for executing an HTTP request. If data type is not specified,\np5 will try to guess based on the URL, defaulting to text." - }, - { - "type": "html", - "value": "
" - }, - { - "type": "html", - "value": "
" - }, - { - "type": "text", - "value": "\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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "httpDo" - }, - { - "title": "param", - "description": "name of the file or url to load", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "path" - }, - { - "title": "param", - "description": "either \"GET\", \"POST\", or \"PUT\",\n defaults to \"GET\"", - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "method" - }, - { - "title": "param", - "description": "\"json\", \"jsonp\", \"xml\", or \"text\"", - "lineNumber": 12, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "datatype" - }, - { - "title": "param", - "description": "param data passed sent with request", - "lineNumber": 13, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - }, - "name": "data" - }, - { - "title": "param", - "description": "function to be executed after\n httpGet() completes, data is passed in\n as first argument", - "lineNumber": 14, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "callback" - }, - { - "title": "param", - "description": "function to be executed if\n there is an error, response is passed\n in as first argument", - "lineNumber": 17, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "errorCallback" - }, - { - "title": "return", - "description": "A promise that resolves with the data when the operation\n completes successfully or rejects with the error after\n one occurs.", - "lineNumber": 20, - "type": { - "type": "NameExpression", - "name": "Promise" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 24 - } - ], - "loc": { - "start": { - "line": 898, - "column": 0, - "index": 27563 - }, - "end": { - "line": 968, - "column": 3, - "index": 30160 - } - }, - "context": { - "loc": { - "start": { - "line": 979, - "column": 0, - "index": 30535 - }, - "end": { - "line": 1100, - "column": 2, - "index": 33606 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "path", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "name of the file or url to load" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "method", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either \"GET\", \"POST\", or \"PUT\",\ndefaults to \"GET\"" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - }, - { - "title": "param", - "name": "datatype", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "\"json\", \"jsonp\", \"xml\", or \"text\"" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - }, - { - "title": "param", - "name": "data", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "param data passed sent with request" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to be executed after\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "httpGet()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " completes, data is passed in\nas first argument" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - }, - { - "title": "param", - "name": "errorCallback", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to be executed if\nthere is an error, response is passed\nin as first argument" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A promise that resolves with the data when the operation\ncompletes successfully or rejects with the error after\none occurs." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Promise" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "httpDo", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "httpDo", - "kind": "function" - } - ], - "namespace": "httpDo" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "httpDo" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "path" - }, - { - "title": "param", - "description": "Request object options as documented in the\n \"fetch\" API\nreference", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Object" - }, - "name": "options" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "callback" - }, - { - "title": "param", - "description": null, - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "errorCallback" - }, - { - "title": "return", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Promise" - } - } - ], - "loc": { - "start": { - "line": 969, - "column": 0, - "index": 30161 - }, - "end": { - "line": 978, - "column": 3, - "index": 30534 - } - }, - "context": { - "loc": { - "start": { - "line": 979, - "column": 0, - "index": 30535 - }, - "end": { - "line": 1100, - "column": 2, - "index": 33606 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "path", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "options", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Request object options as documented in the\n\"fetch\" API\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "reference" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - }, - { - "title": "param", - "name": "errorCallback", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Promise" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "httpDo", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "httpDo", - "kind": "function" - } - ], - "namespace": "httpDo" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "createWriter" - }, - { - "title": "param", - "description": "name of the file to be created", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "name" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "extension" - }, - { - "title": "return", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "p5.PrintWriter" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 1113, - "column": 0, - "index": 33782 - }, - "end": { - "line": 1139, - "column": 3, - "index": 34398 - } - }, - "context": { - "loc": { - "start": { - "line": 1140, - "column": 0, - "index": 34399 - }, - "end": { - "line": 1156, - "column": 2, - "index": 35045 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "name", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "name of the file to be created" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "extension", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.PrintWriter" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createWriter", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createWriter", - "kind": "function" - } - ], - "namespace": "createWriter" - }, - { - "description": "", - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 1, - "type": null, - "name": "p5.PrintWriter" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "filename" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "extension" - } - ], - "loc": { - "start": { - "line": 1158, - "column": 0, - "index": 35047 - }, - "end": { - "line": 1162, - "column": 3, - "index": 35151 - } - }, - "context": { - "loc": { - "start": { - "line": 1163, - "column": 0, - "index": 35152 - }, - "end": { - "line": 1340, - "column": 2, - "index": 39932 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "filename", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "extension", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "class", - "name": "p5.PrintWriter", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.PrintWriter", - "kind": "class" - } - ], - "namespace": "p5.PrintWriter" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes data to the PrintWriter stream" - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 2, - "name": "write" - }, - { - "title": "param", - "description": "all data to be written by the PrintWriter", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "data" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 1168, - "column": 2, - "index": 35339 - }, - "end": { - "line": 1223, - "column": 5, - "index": 36990 - } - }, - "context": { - "loc": { - "start": { - "line": 1224, - "column": 2, - "index": 36993 - }, - "end": { - "line": 1226, - "column": 4, - "index": 37053 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "data", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "all data to be written by the PrintWriter" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "write", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "write", - "kind": "function" - } - ], - "namespace": "write" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Closes the PrintWriter" - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 2, - "name": "close" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 1302, - "column": 2, - "index": 38848 - }, - "end": { - "line": 1324, - "column": 5, - "index": 39454 - } - }, - "context": { - "loc": { - "start": { - "line": 1325, - "column": 2, - "index": 39457 - }, - "end": { - "line": 1339, - "column": 4, - "index": 39929 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "close", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "close", - "kind": "function" - } - ], - "namespace": "close" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Element" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",an Array of\nStrings, an Array of JSON, a JSON object, a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Table\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Image" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", 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.\n" - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "Note that it is not recommended to\ncall this method within draw, as it will open a new save dialog on every\nrender." - } - ] - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 16, - "name": "save" - }, - { - "title": "param", - "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).", - "lineNumber": 17, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - "name": "objectOrFilename" - }, - { - "title": "param", - "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).", - "lineNumber": 25, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "filename" - }, - { - "title": "param", - "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.", - "lineNumber": 30, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Boolean" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - "name": "options" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 36 - } - ], - "loc": { - "start": { - "line": 1351, - "column": 0, - "index": 40094 - }, - "end": { - "line": 1446, - "column": 3, - "index": 43986 - } - }, - "context": { - "loc": { - "start": { - "line": 1448, - "column": 0, - "index": 43988 - }, - "end": { - "line": 1493, - "column": 2, - "index": 45837 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "objectOrFilename", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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)." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - }, - { - "title": "param", - "name": "filename", - "lineNumber": 25, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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)." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - }, - { - "title": "param", - "name": "options", - "lineNumber": 30, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Additional options depend on\nfiletype. For example, when saving JSON,\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "true" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " indicates that the\noutput will be optimized for filesize,\nrather than readability." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Boolean" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "save", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "save", - "kind": "function" - } - ], - "namespace": "save" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "saveJSON" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Array" - }, - { - "type": "NameExpression", - "name": "Object" - } - ] - }, - "name": "json" - }, - { - "title": "param", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "filename" - }, - { - "title": "param", - "description": "If true, removes line breaks\n and spaces from the output\n file to optimize filesize\n (but not readability).", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - }, - "name": "optimize" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 1495, - "column": 0, - "index": 45839 - }, - "end": { - "line": 1535, - "column": 3, - "index": 46972 - } - }, - "context": { - "loc": { - "start": { - "line": 1536, - "column": 0, - "index": 46973 - }, - "end": { - "line": 1545, - "column": 2, - "index": 47276 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "json", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Array" - }, - { - "type": "NameExpression", - "name": "Object" - } - ] - } - }, - { - "title": "param", - "name": "filename", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "optimize", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If true, removes line breaks\nand spaces from the output\nfile to optimize filesize\n(but not readability)." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "saveJSON", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "saveJSON", - "kind": "function" - } - ], - "namespace": "saveJSON" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "saveStrings" - }, - { - "title": "param", - "description": "string array to be written", - "lineNumber": 6, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "list" - }, - { - "title": "param", - "description": "filename for output", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "filename" - }, - { - "title": "param", - "description": "the filename's extension", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "extension" - }, - { - "title": "param", - "description": "if true, change line-break to CRLF", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - }, - "name": "isCRLF" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 1550, - "column": 0, - "index": 47384 - }, - "end": { - "line": 1587, - "column": 3, - "index": 48394 - } - }, - "context": { - "loc": { - "start": { - "line": 1588, - "column": 0, - "index": 48395 - }, - "end": { - "line": 1597, - "column": 2, - "index": 48770 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "list", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "string array to be written" - } - ] - } - ] - }, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "param", - "name": "filename", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "filename for output" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "extension", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the filename's extension" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - }, - { - "title": "param", - "name": "isCRLF", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "if true, change line-break to CRLF" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "saveStrings", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "saveStrings", - "kind": "function" - } - ], - "namespace": "saveStrings" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Writes the contents of a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 7, - "name": "saveTable" - }, - { - "title": "param", - "description": "the Table object to save to a file", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "p5.Table" - }, - "name": "Table" - }, - { - "title": "param", - "description": "the filename to which the Table should be saved", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "filename" - }, - { - "title": "param", - "description": "can be one of \"tsv\", \"csv\", or \"html\"", - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "options" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 1612, - "column": 0, - "index": 49000 - }, - "end": { - "line": 1649, - "column": 3, - "index": 50218 - } - }, - "context": { - "loc": { - "start": { - "line": 1650, - "column": 0, - "index": 50219 - }, - "end": { - "line": 1742, - "column": 2, - "index": 53072 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/files.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "Table", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object to save to a file" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Table" - } - }, - { - "title": "param", - "name": "filename", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the filename to which the Table should be saved" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "options", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "can be one of \"tsv\", \"csv\", or \"html\"" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "saveTable", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "saveTable", - "kind": "function" - } - ], - "namespace": "saveTable" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Table" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 5, - "type": null, - "name": "p5.Table" - }, - { - "title": "param", - "description": "An array of p5.TableRow objects", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - "name": "rows" - } - ], - "loc": { - "start": { - "line": 33, - "column": 0, - "index": 1055 - }, - "end": { - "line": 40, - "column": 3, - "index": 1378 - } - }, - "context": { - "loc": { - "start": { - "line": 41, - "column": 0, - "index": 1379 - }, - "end": { - "line": 1259, - "column": 2, - "index": 33791 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "rows", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An array of p5.TableRow objects" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "class", - "name": "p5.Table", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.Table", - "kind": "class" - } - ], - "namespace": "p5.Table" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An array containing the names of the columns in the table, if the \"header\" the table is\nloaded with the \"header\" parameter." - } - ] - } - ] - }, - "tags": [ - { - "title": "type", - "description": null, - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "for", - "description": "p5.Table", - "lineNumber": 4 - }, - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "columns" - }, - { - "title": "name", - "description": null, - "lineNumber": 6, - "name": "columns" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 1261, - "column": 0, - "index": 33793 - }, - "end": { - "line": 1295, - "column": 3, - "index": 34664 - } - }, - "context": { - "loc": { - "start": { - "line": 1306, - "column": 0, - "index": 34924 - }, - "end": { - "line": 1306, - "column": 18, - "index": 34942 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "columns", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "columns" - } - ], - "namespace": "columns" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An array containing the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.TableRow" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " objects that make up the\nrows of the table. The same result as calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "getRows()" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.Table", - "lineNumber": 3 - }, - { - "title": "type", - "description": null, - "lineNumber": 4, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - } - }, - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "rows" - }, - { - "title": "name", - "description": null, - "lineNumber": 6, - "name": "rows" - } - ], - "loc": { - "start": { - "line": 1297, - "column": 0, - "index": 34666 - }, - "end": { - "line": 1304, - "column": 3, - "index": 34922 - } - }, - "context": { - "loc": { - "start": { - "line": 1306, - "column": 0, - "index": 34924 - }, - "end": { - "line": 1306, - "column": 18, - "index": 34942 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.Table.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "p5.TableRow" - } - ] - }, - "name": "rows", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "rows" - } - ], - "namespace": "rows" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A TableRow object represents a single row of data values,\nstored in columns, from a table." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A Table Row contains both an ordered array, and an unordered\nJSON object." - } - ] - } - ] - }, - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 7, - "type": null, - "name": "p5.TableRow" - }, - { - "title": "constructor", - "description": null, - "lineNumber": 8, - "type": null, - "name": null - }, - { - "title": "param", - "description": "optional: populate the row with a\n string of values, separated by the\n separator", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "str" - }, - { - "title": "param", - "description": "comma separated values (csv) by default", - "lineNumber": 12, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "separator" - } - ], - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 93 - }, - "end": { - "line": 22, - "column": 3, - "index": 574 - } - }, - "context": { - "loc": { - "start": { - "line": 23, - "column": 0, - "index": 575 - }, - "end": { - "line": 334, - "column": 2, - "index": 8809 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.TableRow.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "str", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional: populate the row with a\nstring of values, separated by the\nseparator" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - }, - { - "title": "param", - "name": "separator", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "comma separated values (csv) by default" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "class", - "name": "p5.TableRow", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.TableRow", - "kind": "class" - } - ], - "namespace": "p5.TableRow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Stores a Float value in the TableRow's specified column.\nThe column may be specified by either its ID or title." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "setNum" - }, - { - "title": "param", - "description": "Column ID (Number)\n or Title (String)", - "lineNumber": 5, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "The value to be stored\n as a Float", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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].setNum('id', r + 10);\n }\n\n print(table.getArray());\n\n describe('no image displayed');\n}\n
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 97, - "column": 2, - "index": 2559 - }, - "end": { - "line": 134, - "column": 3, - "index": 3601 - } - }, - "context": { - "loc": { - "start": { - "line": 135, - "column": 2, - "index": 3604 - }, - "end": { - "line": 138, - "column": 3, - "index": 3703 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.TableRow.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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].setNum('id', r + 10);\n }\n\n print(table.getArray());\n\n describe('no image displayed');\n}\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "column", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (Number)\nor Title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to be stored\nas a Float" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "setNum", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setNum", - "kind": "function" - } - ], - "namespace": "setNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Stores a String value in the TableRow's specified column.\nThe column may be specified by either its ID or title." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "setString" - }, - { - "title": "param", - "description": "Column ID (Number)\n or Title (String)", - "lineNumber": 5, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "param", - "description": "The value to be stored\n as a String", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "Boolean" - }, - { - "type": "NameExpression", - "name": "Object" - } - ] - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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 let name = rows[r].getString('name');\n rows[r].setString('name', 'A ' + name + ' named George');\n }\n\n print(table.getArray());\n\n describe('no image displayed');\n}\n
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 140, - "column": 2, - "index": 3707 - }, - "end": { - "line": 178, - "column": 3, - "index": 4842 - } - }, - "context": { - "loc": { - "start": { - "line": 179, - "column": 2, - "index": 4845 - }, - "end": { - "line": 182, - "column": 3, - "index": 4948 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.TableRow.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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 let name = rows[r].getString('name');\n rows[r].setString('name', 'A ' + name + ' named George');\n }\n\n print(table.getArray());\n\n describe('no image displayed');\n}\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "column", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Column ID (Number)\nor Title (String)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The value to be stored\nas a String" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "Boolean" - }, - { - "type": "NameExpression", - "name": "Object" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "setString", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setString", - "kind": "function" - } - ], - "namespace": "setString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves a Float value from the TableRow's specified\ncolumn. The column may be specified by either its ID or\ntitle." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "getNum" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "Float Floating point number", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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 let minId = Infinity;\n let maxId = -Infinity;\n for (let r = 0; r < rows.length; r++) {\n let id = rows[r].getNum('id');\n minId = min(minId, id);\n maxId = min(maxId, id);\n }\n print('minimum id = ' + minId + ', maximum id = ' + maxId);\n describe('no image displayed');\n}\n
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 231, - "column": 2, - "index": 6077 - }, - "end": { - "line": 270, - "column": 3, - "index": 7225 - } - }, - "context": { - "loc": { - "start": { - "line": 271, - "column": 2, - "index": 7228 - }, - "end": { - "line": 283, - "column": 3, - "index": 7525 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.TableRow.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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 let minId = Infinity;\n let maxId = -Infinity;\n for (let r = 0; r < rows.length; r++) {\n let id = rows[r].getNum('id');\n minId = min(minId, id);\n maxId = min(maxId, id);\n }\n print('minimum id = ' + minId + ', maximum id = ' + maxId);\n describe('no image displayed');\n}\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Float Floating point number" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "getNum", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "getNum", - "kind": "function" - } - ], - "namespace": "getNum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Retrieves an String value from the TableRow's specified\ncolumn. The column may be specified by either its ID or\ntitle." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "getString" - }, - { - "title": "param", - "description": "columnName (string) or\n ID (number)", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - }, - "name": "column" - }, - { - "title": "return", - "description": "String", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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 let longest = '';\n for (let r = 0; r < rows.length; r++) {\n let species = rows[r].getString('species');\n if (longest.length < species.length) {\n longest = species;\n }\n }\n\n print('longest: ' + longest);\n\n describe('no image displayed');\n}\n
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 285, - "column": 2, - "index": 7529 - }, - "end": { - "line": 326, - "column": 3, - "index": 8639 - } - }, - "context": { - "loc": { - "start": { - "line": 327, - "column": 2, - "index": 8642 - }, - "end": { - "line": 333, - "column": 3, - "index": 8806 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.TableRow.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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 let longest = '';\n for (let r = 0; r < rows.length; r++) {\n let species = rows[r].getString('species');\n if (longest.length < species.length) {\n longest = species;\n }\n }\n\n print('longest: ' + longest);\n\n describe('no image displayed');\n}\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "column", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "columnName (string) or\nID (number)" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Integer" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "getString", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "getString", - "kind": "function" - } - ], - "namespace": "getString" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "XML is a representation of an XML object, able to parse XML code. Use\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadXML()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to load external XML files and create XML objects." - } - ] - } - ] - }, - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 4, - "type": null, - "name": "p5.XML" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 93 - }, - "end": { - "line": 50, - "column": 3, - "index": 1299 - } - }, - "context": { - "loc": { - "start": { - "line": 51, - "column": 0, - "index": 1300 - }, - "end": { - "line": 844, - "column": 2, - "index": 22146 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/io/p5.XML.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "class", - "name": "p5.XML", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.XML", - "kind": "class" - } - ], - "namespace": "p5.XML" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Math" - }, - { - "title": "submodule", - "description": "Calculation", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 78 - } - }, - "context": { - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 80 - }, - "end": { - "line": 770, - "column": 1, - "index": 20814 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Math", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Math", - "kind": "module" - } - ], - "namespace": "Math" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Math" - }, - { - "title": "submodule", - "description": "Vector", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 73 - } - }, - "context": { - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 75 - }, - "end": { - "line": 85, - "column": 1, - "index": 2441 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/math.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Math", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Math", - "kind": "module" - } - ], - "namespace": "Math" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Math" - }, - { - "title": "submodule", - "description": "Noise", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 14, - "column": 0, - "index": 508 - }, - "end": { - "line": 19, - "column": 3, - "index": 580 - } - }, - "context": { - "loc": { - "start": { - "line": 20, - "column": 0, - "index": 581 - }, - "end": { - "line": 406, - "column": 1, - "index": 12104 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/noise.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Math", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Math", - "kind": "module" - } - ], - "namespace": "Math" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Math" - }, - { - "title": "submodule", - "description": "Vector", - "lineNumber": 2 - }, - { - "title": "requires", - "description": null, - "lineNumber": 3, - "name": "constants" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 5, - "column": 3, - "index": 67 - } - }, - "context": { - "loc": { - "start": { - "line": 7, - "column": 0, - "index": 69 - }, - "end": { - "line": 7, - "column": 47, - "index": 116 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Math", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Math", - "kind": "module" - } - ], - "namespace": "Math" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Math" - }, - { - "title": "submodule", - "description": "Random", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 73 - } - }, - "context": { - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 75 - }, - "end": { - "line": 266, - "column": 1, - "index": 8211 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/random.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Math", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Math", - "kind": "module" - } - ], - "namespace": "Math" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Math" - }, - { - "title": "submodule", - "description": "Trigonometry", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - }, - { - "title": "requires", - "description": null, - "lineNumber": 5, - "name": "constants" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 7, - "column": 3, - "index": 102 - } - }, - "context": { - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 104 - }, - "end": { - "line": 9, - "column": 47, - "index": 151 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/trigonometry.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Math", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Math", - "kind": "module" - } - ], - "namespace": "Math" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "inlineCode", - "value": "abs(-5)" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "abs(5)" - }, - { - "type": "text", - "value": " both return 5. The absolute\nvalue of a number is always positive." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "abs" - }, - { - "title": "param", - "description": "number to compute.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "n" - }, - { - "title": "return", - "description": "absolute value of given number.", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 9, - "column": 2, - "index": 112 - }, - "end": { - "line": 35, - "column": 5, - "index": 882 - } - }, - "context": { - "loc": { - "start": { - "line": 36, - "column": 2, - "index": 885 - }, - "end": { - "line": 36, - "column": 20, - "index": 903 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number to compute." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "absolute value of given number." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "abs", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "abs", - "kind": "function" - } - ], - "namespace": "abs" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates the closest integer value that is greater than or equal to the\nparameter's value. For example, calling " - }, - { - "type": "inlineCode", - "value": "ceil(9.03)" - }, - { - "type": "text", - "value": " returns the value\n10." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "ceil" - }, - { - "title": "param", - "description": "number to round up.", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "n" - }, - { - "title": "return", - "description": "rounded up number.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 38, - "column": 2, - "index": 907 - }, - "end": { - "line": 65, - "column": 5, - "index": 1646 - } - }, - "context": { - "loc": { - "start": { - "line": 66, - "column": 2, - "index": 1649 - }, - "end": { - "line": 66, - "column": 22, - "index": 1669 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number to round up." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "rounded up number." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "ceil", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ceil", - "kind": "function" - } - ], - "namespace": "ceil" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Constrains a number between a minimum and maximum value." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 3, - "name": "constrain" - }, - { - "title": "param", - "description": "number to constrain.", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "n" - }, - { - "title": "param", - "description": "minimum limit.", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "low" - }, - { - "title": "param", - "description": "maximum limit.", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "high" - }, - { - "title": "return", - "description": "constrained number.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 68, - "column": 2, - "index": 1673 - }, - "end": { - "line": 117, - "column": 5, - "index": 3064 - } - }, - "context": { - "loc": { - "start": { - "line": 118, - "column": 2, - "index": 3067 - }, - "end": { - "line": 121, - "column": 4, - "index": 3208 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number to constrain." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "low", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "minimum limit." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "high", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "maximum limit." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "constrained number." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "constrain", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "constrain", - "kind": "function" - } - ], - "namespace": "constrain" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates the distance between two points." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "dist()" - }, - { - "type": "text", - "value": " with four parameters calculates distance in two\ndimensions." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "dist()" - }, - { - "type": "text", - "value": " with six parameters calculates distance in three\ndimensions." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector.dist()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to calculate the\ndistance between two " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " objects." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 12, - "name": "dist" - }, - { - "title": "param", - "description": "x-coordinate of the first point.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x1" - }, - { - "title": "param", - "description": "y-coordinate of the first point.", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y1" - }, - { - "title": "param", - "description": "x-coordinate of the second point.", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x2" - }, - { - "title": "param", - "description": "y-coordinate of the second point.", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y2" - }, - { - "title": "return", - "description": "distance between the two points.", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 19 - } - ], - "loc": { - "start": { - "line": 123, - "column": 2, - "index": 3212 - }, - "end": { - "line": 161, - "column": 5, - "index": 4348 - } - }, - "context": { - "loc": { - "start": { - "line": 172, - "column": 2, - "index": 4656 - }, - "end": { - "line": 183, - "column": 4, - "index": 4986 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x1", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the first point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y1", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the first point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x2", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the second point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y2", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the second point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "distance between the two points." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "dist", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "dist", - "kind": "function" - } - ], - "namespace": "dist" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "dist" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x1" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y1" - }, - { - "title": "param", - "description": "z-coordinate of the first point.", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z1" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x2" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y2" - }, - { - "title": "param", - "description": "z-coordinate of the second point.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z2" - }, - { - "title": "return", - "description": "distance between the two points.", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "loc": { - "start": { - "line": 162, - "column": 2, - "index": 4351 - }, - "end": { - "line": 171, - "column": 5, - "index": 4653 - } - }, - "context": { - "loc": { - "start": { - "line": 172, - "column": 2, - "index": 4656 - }, - "end": { - "line": 183, - "column": 4, - "index": 4986 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x1", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y1", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z1", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z-coordinate of the first point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x2", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y2", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z2", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z-coordinate of the second point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "distance between the two points." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "dist", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "dist", - "kind": "function" - } - ], - "namespace": "dist" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns Euler's number e (2.71828...) raised to the power of the " - }, - { - "type": "inlineCode", - "value": "n" - }, - { - "type": "text", - "value": "\nparameter." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "exp" - }, - { - "title": "param", - "description": "exponent to raise.", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "n" - }, - { - "title": "return", - "description": "e^n", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 185, - "column": 2, - "index": 4990 - }, - "end": { - "line": 208, - "column": 5, - "index": 5535 - } - }, - "context": { - "loc": { - "start": { - "line": 209, - "column": 2, - "index": 5538 - }, - "end": { - "line": 209, - "column": 20, - "index": 5556 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "exponent to raise." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "e^n" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "exp", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "exp", - "kind": "function" - } - ], - "namespace": "exp" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates the closest integer value that is less than or equal to the\nvalue of the " - }, - { - "type": "inlineCode", - "value": "n" - }, - { - "type": "text", - "value": " parameter." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "floor" - }, - { - "title": "param", - "description": "number to round down.", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "n" - }, - { - "title": "return", - "description": "rounded down number.", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 211, - "column": 2, - "index": 5560 - }, - "end": { - "line": 237, - "column": 5, - "index": 6248 - } - }, - "context": { - "loc": { - "start": { - "line": 238, - "column": 2, - "index": 6251 - }, - "end": { - "line": 238, - "column": 24, - "index": 6273 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number to round down." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "rounded down number." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "floor", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "floor", - "kind": "function" - } - ], - "namespace": "floor" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates a number between two numbers at a specific increment. The " - }, - { - "type": "inlineCode", - "value": "amt" - }, - { - "type": "text", - "value": "\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 " - }, - { - "type": "inlineCode", - "value": "lerp()" - }, - { - "type": "text", - "value": "\nfunction is convenient for creating motion along a straight path and for\ndrawing dotted lines." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If the value of " - }, - { - "type": "inlineCode", - "value": "amt" - }, - { - "type": "text", - "value": " is less than 0 or more than 1, " - }, - { - "type": "inlineCode", - "value": "lerp()" - }, - { - "type": "text", - "value": " will return a\nnumber outside of the original interval. For example, calling\n" - }, - { - "type": "inlineCode", - "value": "lerp(0, 10, 1.5)" - }, - { - "type": "text", - "value": " will return 15." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 12, - "name": "lerp" - }, - { - "title": "param", - "description": "first value.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "start" - }, - { - "title": "param", - "description": "second value.", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "stop" - }, - { - "title": "param", - "description": "number.", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "amt" - }, - { - "title": "return", - "description": "lerped value.", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 17 - } - ], - "loc": { - "start": { - "line": 240, - "column": 2, - "index": 6277 - }, - "end": { - "line": 284, - "column": 5, - "index": 7643 - } - }, - "context": { - "loc": { - "start": { - "line": 285, - "column": 2, - "index": 7646 - }, - "end": { - "line": 288, - "column": 4, - "index": 7777 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "start", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "first value." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "stop", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "second value." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "amt", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "lerped value." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "lerp", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "lerp", - "kind": "function" - } - ], - "namespace": "lerp" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates the magnitude, or length, of a vector. A vector is like an arrow\npointing in space. Vectors are commonly used for programming motion." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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). " - }, - { - "type": "inlineCode", - "value": "mag(x, y)" - }, - { - "type": "text", - "value": " is a shortcut for calling\n" - }, - { - "type": "inlineCode", - "value": "dist(0, 0, x, y)" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "mag" - }, - { - "title": "param", - "description": "first component.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "second component.", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "return", - "description": "magnitude of vector from (0,0) to (x,y).", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 316, - "column": 2, - "index": 8426 - }, - "end": { - "line": 342, - "column": 5, - "index": 9325 - } - }, - "context": { - "loc": { - "start": { - "line": 343, - "column": 2, - "index": 9328 - }, - "end": { - "line": 346, - "column": 4, - "index": 9433 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "first component." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "second component." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "magnitude of vector from (0,0) to (x,y)." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "mag", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "mag", - "kind": "function" - } - ], - "namespace": "mag" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Re-maps a number from one range to another." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "For example, calling " - }, - { - "type": "inlineCode", - "value": "map(2, 0, 10, 0, 100)" - }, - { - "type": "text", - "value": " 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]." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "map" - }, - { - "title": "param", - "description": "the incoming value to be converted.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "value" - }, - { - "title": "param", - "description": "lower bound of the value's current range.", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "start1" - }, - { - "title": "param", - "description": "upper bound of the value's current range.", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "stop1" - }, - { - "title": "param", - "description": "lower bound of the value's target range.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "start2" - }, - { - "title": "param", - "description": "upper bound of the value's target range.", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "stop2" - }, - { - "title": "param", - "description": "constrain the value to the newly mapped range.", - "lineNumber": 15, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - }, - "name": "withinBounds" - }, - { - "title": "return", - "description": "remapped number.", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 17 - } - ], - "loc": { - "start": { - "line": 348, - "column": 2, - "index": 9437 - }, - "end": { - "line": 397, - "column": 5, - "index": 11037 - } - }, - "context": { - "loc": { - "start": { - "line": 398, - "column": 2, - "index": 11040 - }, - "end": { - "line": 409, - "column": 4, - "index": 11438 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the incoming value to be converted." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "start1", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "lower bound of the value's current range." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "stop1", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "upper bound of the value's current range." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "start2", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "lower bound of the value's target range." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "stop2", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "upper bound of the value's target range." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "withinBounds", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "constrain the value to the newly mapped range." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "remapped number." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "map", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "map", - "kind": "function" - } - ], - "namespace": "map" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the largest value in a sequence of numbers." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "max()" - }, - { - "type": "text", - "value": " with one parameter interprets it as an array of\nnumbers and returns the largest number." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "max()" - }, - { - "type": "text", - "value": " with two or more parameters interprets them as\nindividual numbers and returns the largest number." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "max" - }, - { - "title": "param", - "description": "first number to compare.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "n0" - }, - { - "title": "param", - "description": "second number to compare.", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "n1" - }, - { - "title": "return", - "description": "maximum number.", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 411, - "column": 2, - "index": 11442 - }, - "end": { - "line": 467, - "column": 5, - "index": 12948 - } - }, - "context": { - "loc": { - "start": { - "line": 473, - "column": 2, - "index": 13051 - }, - "end": { - "line": 487, - "column": 4, - "index": 13347 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n0", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "first number to compare." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "n1", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "second number to compare." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "maximum number." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "max", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "max", - "kind": "function" - } - ], - "namespace": "max" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "max" - }, - { - "title": "param", - "description": "numbers to compare.", - "lineNumber": 2, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "nums" - }, - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "loc": { - "start": { - "line": 468, - "column": 2, - "index": 12951 - }, - "end": { - "line": 472, - "column": 5, - "index": 13048 - } - }, - "context": { - "loc": { - "start": { - "line": 473, - "column": 2, - "index": 13051 - }, - "end": { - "line": 487, - "column": 4, - "index": 13347 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "nums", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "numbers to compare." - } - ] - } - ] - }, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "max", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "max", - "kind": "function" - } - ], - "namespace": "max" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the smallest value in a sequence of numbers." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "min()" - }, - { - "type": "text", - "value": " with one parameter interprets it as an array of\nnumbers and returns the smallest number." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "min()" - }, - { - "type": "text", - "value": " with two or more parameters interprets them as\nindividual numbers and returns the smallest number." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "min" - }, - { - "title": "param", - "description": "first number to compare.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "n0" - }, - { - "title": "param", - "description": "second number to compare.", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "n1" - }, - { - "title": "return", - "description": "minimum number.", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 489, - "column": 2, - "index": 13351 - }, - "end": { - "line": 545, - "column": 5, - "index": 14860 - } - }, - "context": { - "loc": { - "start": { - "line": 551, - "column": 2, - "index": 14963 - }, - "end": { - "line": 565, - "column": 4, - "index": 15258 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n0", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "first number to compare." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "n1", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "second number to compare." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "minimum number." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "min", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "min", - "kind": "function" - } - ], - "namespace": "min" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "min" - }, - { - "title": "param", - "description": "numbers to compare.", - "lineNumber": 2, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "nums" - }, - { - "title": "return", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "loc": { - "start": { - "line": 546, - "column": 2, - "index": 14863 - }, - "end": { - "line": 550, - "column": 5, - "index": 14960 - } - }, - "context": { - "loc": { - "start": { - "line": 551, - "column": 2, - "index": 14963 - }, - "end": { - "line": 565, - "column": 4, - "index": 15258 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "nums", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "numbers to compare." - } - ] - } - ] - }, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "min", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "min", - "kind": "function" - } - ], - "namespace": "min" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Maps a number from one range to a value between 0 and 1." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "For example, " - }, - { - "type": "inlineCode", - "value": "norm(2, 0, 10)" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "inlineCode", - "value": "map(2, 0, 10, 0, 1)" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Numbers outside of the original range are not constrained between 0 and 1.\nOut-of-range values are often intentional and useful." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 10, - "name": "norm" - }, - { - "title": "param", - "description": "incoming value to be normalized.", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "value" - }, - { - "title": "param", - "description": "lower bound of the value's current range.", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "start" - }, - { - "title": "param", - "description": "upper bound of the value's current range.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "stop" - }, - { - "title": "return", - "description": "normalized number.", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 15 - } - ], - "loc": { - "start": { - "line": 567, - "column": 2, - "index": 15262 - }, - "end": { - "line": 596, - "column": 5, - "index": 16309 - } - }, - "context": { - "loc": { - "start": { - "line": 597, - "column": 2, - "index": 16312 - }, - "end": { - "line": 600, - "column": 4, - "index": 16443 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "incoming value to be normalized." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "start", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "lower bound of the value's current range." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "stop", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "upper bound of the value's current range." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "normalized number." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "norm", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "norm", - "kind": "function" - } - ], - "namespace": "norm" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates exponential expressions such as 2^3." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "For example, " - }, - { - "type": "inlineCode", - "value": "pow(2, 3)" - }, - { - "type": "text", - "value": " is equivalent to the expression\n2 × 2 × 2. " - }, - { - "type": "inlineCode", - "value": "pow(2, -3)" - }, - { - "type": "text", - "value": " is equivalent to 1 ÷\n(2 × 2 × 2)." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 7, - "name": "pow" - }, - { - "title": "param", - "description": "base of the exponential expression.", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "n" - }, - { - "title": "param", - "description": "power by which to raise the base.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "e" - }, - { - "title": "return", - "description": "n^e.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 602, - "column": 2, - "index": 16447 - }, - "end": { - "line": 633, - "column": 5, - "index": 17233 - } - }, - "context": { - "loc": { - "start": { - "line": 634, - "column": 2, - "index": 17236 - }, - "end": { - "line": 634, - "column": 20, - "index": 17254 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "base of the exponential expression." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "e", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "power by which to raise the base." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "n^e." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "pow", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "pow", - "kind": "function" - } - ], - "namespace": "pow" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates the integer closest to the " - }, - { - "type": "inlineCode", - "value": "n" - }, - { - "type": "text", - "value": " parameter. For example,\n" - }, - { - "type": "inlineCode", - "value": "round(133.8)" - }, - { - "type": "text", - "value": " returns the value 134." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "round" - }, - { - "title": "param", - "description": "number to round.", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "n" - }, - { - "title": "param", - "description": "number of decimal places to round to, default is 0.", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "decimals" - }, - { - "title": "return", - "description": "rounded number.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 636, - "column": 2, - "index": 17258 - }, - "end": { - "line": 662, - "column": 5, - "index": 17953 - } - }, - "context": { - "loc": { - "start": { - "line": 663, - "column": 2, - "index": 17956 - }, - "end": { - "line": 669, - "column": 4, - "index": 18149 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number to round." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "decimals", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of decimal places to round to, default is 0." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "rounded number." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "round", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "round", - "kind": "function" - } - ], - "namespace": "round" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Squares a number, which means multiplying the number by itself. The value\nreturned is always a positive number." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "For example, " - }, - { - "type": "inlineCode", - "value": "sq(3)" - }, - { - "type": "text", - "value": " evaluates 3 × 3 which is 9. " - }, - { - "type": "inlineCode", - "value": "sq(-3)" - }, - { - "type": "text", - "value": " evaluates\n-3 × -3 which is also 9. Multiplying two negative numbers produces\na positive number." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "sq" - }, - { - "title": "param", - "description": "number to square.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "n" - }, - { - "title": "return", - "description": "squared number.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 671, - "column": 2, - "index": 18153 - }, - "end": { - "line": 698, - "column": 5, - "index": 18920 - } - }, - "context": { - "loc": { - "start": { - "line": 699, - "column": 2, - "index": 18923 - }, - "end": { - "line": 699, - "column": 21, - "index": 18942 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number to square." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "squared number." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "sq", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "sq", - "kind": "function" - } - ], - "namespace": "sq" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates the square root of a number. A number's square root can be\nmultiplied by itself to produce the original number." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "For example, " - }, - { - "type": "inlineCode", - "value": "sqrt(9)" - }, - { - "type": "text", - "value": " returns 3 because 3 × 3 = 9. " - }, - { - "type": "inlineCode", - "value": "sqrt()" - }, - { - "type": "text", - "value": " always\nreturns a positive value. " - }, - { - "type": "inlineCode", - "value": "sqrt()" - }, - { - "type": "text", - "value": " doesn't work with negative arguments\nsuch as " - }, - { - "type": "inlineCode", - "value": "sqrt(-9)" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "sqrt" - }, - { - "title": "param", - "description": "non-negative number to square root.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "n" - }, - { - "title": "return", - "description": "square root of number.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 701, - "column": 2, - "index": 18946 - }, - "end": { - "line": 728, - "column": 5, - "index": 19747 - } - }, - "context": { - "loc": { - "start": { - "line": 729, - "column": 2, - "index": 19750 - }, - "end": { - "line": 729, - "column": 22, - "index": 19770 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "non-negative number to square root." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "square root of number." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "sqrt", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "sqrt", - "kind": "function" - } - ], - "namespace": "sqrt" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates the fractional part of a number. For example,\n" - }, - { - "type": "inlineCode", - "value": "fract(12.34)" - }, - { - "type": "text", - "value": " returns 0.34." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "fract" - }, - { - "title": "param", - "description": "number whose fractional part will be found.", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "n" - }, - { - "title": "returns", - "description": "fractional part of n.", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 731, - "column": 2, - "index": 19774 - }, - "end": { - "line": 749, - "column": 5, - "index": 20235 - } - }, - "context": { - "loc": { - "start": { - "line": 750, - "column": 2, - "index": 20238 - }, - "end": { - "line": 769, - "column": 4, - "index": 20812 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/calculation.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number whose fractional part will be found." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "fractional part of n." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "fract", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "fract", - "kind": "function" - } - ], - "namespace": "fract" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object. A vector is like\nan arrow pointing in space. Vectors have both magnitude (length)\nand direction. Calling " - }, - { - "type": "inlineCode", - "value": "createVector()" - }, - { - "type": "text", - "value": " without arguments sets the new\nvector's components to 0." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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\n" - }, - { - "type": "inlineCode", - "value": "pos.add(vel)" - }, - { - "type": "text", - "value": ". Vector math relies on methods inside the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " class." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 16, - "name": "createVector" - }, - { - "title": "param", - "description": "x component of the vector.", - "lineNumber": 17, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "x" - }, - { - "title": "param", - "description": "y component of the vector.", - "lineNumber": 18, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "y" - }, - { - "title": "param", - "description": "z component of the vector.", - "lineNumber": 19, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "z" - }, - { - "title": "return", - "description": "new p5.Vector object.", - "lineNumber": 20, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 21 - } - ], - "loc": { - "start": { - "line": 9, - "column": 2, - "index": 100 - }, - "end": { - "line": 73, - "column": 5, - "index": 2176 - } - }, - "context": { - "loc": { - "start": { - "line": 74, - "column": 2, - "index": 2179 - }, - "end": { - "line": 84, - "column": 4, - "index": 2439 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/math.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x component of the vector." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y component of the vector." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z component of the vector." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createVector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createVector", - "kind": "function" - } - ], - "namespace": "createVector" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns random numbers that can be tuned to feel more organic. The values\nreturned will always be between 0 and 1." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Values returned by " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "random()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "randomGaussian()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " can change by large\namounts between function calls. By contrast, values returned by " - }, - { - "type": "inlineCode", - "value": "noise()" - }, - { - "type": "text", - "value": "\ncan be made \"smooth\". Calls to " - }, - { - "type": "inlineCode", - "value": "noise()" - }, - { - "type": "text", - "value": " with similar inputs will produce\nsimilar outputs. " - }, - { - "type": "inlineCode", - "value": "noise()" - }, - { - "type": "text", - "value": " is used to create textures, motion, shapes,\nterrains, and so on. Ken Perlin invented " - }, - { - "type": "inlineCode", - "value": "noise()" - }, - { - "type": "text", - "value": " while animating the\noriginal " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Tron" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " film in the 1980s." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "noise()" - }, - { - "type": "text", - "value": " returns the same value for a given input while a sketch is\nrunning. It produces different results each time a sketch runs. The\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noiseSeed()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function can be used to generate\nthe same sequence of Perlin noise values each time a sketch runs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The character of the noise can be adjusted in two ways. The first way is to\nscale the inputs. " - }, - { - "type": "inlineCode", - "value": "noise()" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noiseDetail()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfunction." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "noise()" - }, - { - "type": "text", - "value": " with one parameter computes noise values in one\ndimension. This dimension can be thought of as space, as in " - }, - { - "type": "inlineCode", - "value": "noise(x)" - }, - { - "type": "text", - "value": ", or\ntime, as in " - }, - { - "type": "inlineCode", - "value": "noise(t)" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "noise()" - }, - { - "type": "text", - "value": " with two parameters computes noise values in two\ndimensions. These dimensions can be thought of as space, as in\n" - }, - { - "type": "inlineCode", - "value": "noise(x, y)" - }, - { - "type": "text", - "value": ", or space and time, as in " - }, - { - "type": "inlineCode", - "value": "noise(x, t)" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "noise()" - }, - { - "type": "text", - "value": " with three parameters computes noise values in\nthree dimensions. These dimensions can be thought of as space, as in\n" - }, - { - "type": "inlineCode", - "value": "noise(x, y, z)" - }, - { - "type": "text", - "value": ", or space and time, as in " - }, - { - "type": "inlineCode", - "value": "noise(x, y, t)" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 35, - "name": "noise" - }, - { - "title": "param", - "description": "x-coordinate in noise space.", - "lineNumber": 36, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y-coordinate in noise space.", - "lineNumber": 37, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "y" - }, - { - "title": "param", - "description": "z-coordinate in noise space.", - "lineNumber": 38, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "z" - }, - { - "title": "return", - "description": "Perlin noise value at specified coordinates.", - "lineNumber": 39, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 40 - } - ], - "loc": { - "start": { - "line": 34, - "column": 2, - "index": 1025 - }, - "end": { - "line": 196, - "column": 5, - "index": 6111 - } - }, - "context": { - "loc": { - "start": { - "line": 198, - "column": 2, - "index": 6115 - }, - "end": { - "line": 273, - "column": 4, - "index": 7753 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/noise.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 36, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate in noise space." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 37, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate in noise space." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 38, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z-coordinate in noise space." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Perlin noise value at specified coordinates." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "noise", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "noise", - "kind": "function" - } - ], - "namespace": "noise" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Adjusts the character of the noise produced by the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noise()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "By default, noise values are created by combining four octaves. Each higher\noctave contributes half as much (50% less) compared to its predecessor.\n" - }, - { - "type": "inlineCode", - "value": "noiseDetail()" - }, - { - "type": "text", - "value": " changes the number of octaves and the falloff amount. For\nexample, calling " - }, - { - "type": "inlineCode", - "value": "noiseDetail(6, 0.25)" - }, - { - "type": "text", - "value": " ensures that\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noise()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 18, - "name": "noiseDetail" - }, - { - "title": "param", - "description": "number of octaves to be used by the noise.", - "lineNumber": 19, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "lod" - }, - { - "title": "param", - "description": "falloff factor for each octave.", - "lineNumber": 20, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "falloff" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 21 - } - ], - "loc": { - "start": { - "line": 275, - "column": 2, - "index": 7757 - }, - "end": { - "line": 326, - "column": 5, - "index": 9751 - } - }, - "context": { - "loc": { - "start": { - "line": 327, - "column": 2, - "index": 9754 - }, - "end": { - "line": 334, - "column": 4, - "index": 9918 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/noise.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "lod", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of octaves to be used by the noise." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "falloff", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "falloff factor for each octave." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "noiseDetail", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "noiseDetail", - "kind": "function" - } - ], - "namespace": "noiseDetail" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the seed value for " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noise()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". By default,\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noise()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " produces different results each time\na sketch is run. Calling " - }, - { - "type": "inlineCode", - "value": "noiseSeed()" - }, - { - "type": "text", - "value": " with a constant\nargument, such as " - }, - { - "type": "inlineCode", - "value": "noiseSeed(99)" - }, - { - "type": "text", - "value": ", makes " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "noise()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nproduce the same results each time a sketch is run." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 7, - "name": "noiseSeed" - }, - { - "title": "param", - "description": "seed value.", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "seed" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 336, - "column": 2, - "index": 9922 - }, - "end": { - "line": 367, - "column": 5, - "index": 10877 - } - }, - "context": { - "loc": { - "start": { - "line": 368, - "column": 2, - "index": 10880 - }, - "end": { - "line": 405, - "column": 4, - "index": 12102 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/noise.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "seed", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "seed value." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "noiseSeed", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "noiseSeed", - "kind": "function" - } - ], - "namespace": "noiseSeed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "p5.Vector" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "inlineCode", - "value": "pos.add(vel)" - }, - { - "type": "text", - "value": ". Vector math relies on\nmethods inside the " - }, - { - "type": "inlineCode", - "value": "p5.Vector" - }, - { - "type": "text", - "value": " class." - } - ] - } - ] - }, - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 14, - "type": null, - "name": "p5.Vector" - }, - { - "title": "param", - "description": "x component of the vector.", - "lineNumber": 15, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "x" - }, - { - "title": "param", - "description": "y component of the vector.", - "lineNumber": 16, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "y" - }, - { - "title": "param", - "description": "z component of the vector.", - "lineNumber": 17, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "z" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 18 - } - ], - "loc": { - "start": { - "line": 34, - "column": 2, - "index": 720 - }, - "end": { - "line": 93, - "column": 5, - "index": 2551 - } - }, - "context": { - "loc": { - "start": { - "line": 94, - "column": 2, - "index": 2554 - }, - "end": { - "line": 2987, - "column": 4, - "index": 83792 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x component of the vector." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y component of the vector." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z component of the vector." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "class", - "name": "p5.Vector", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.Vector", - "kind": "class" - } - ], - "namespace": "p5.Vector" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The x component of the vector" - } - ] - } - ] - }, - "tags": [ - { - "title": "type", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "for", - "description": "p5.Vector", - "lineNumber": 3 - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "x" - }, - { - "title": "name", - "description": null, - "lineNumber": 5, - "name": "x" - } - ], - "loc": { - "start": { - "line": 2989, - "column": 2, - "index": 83796 - }, - "end": { - "line": 2995, - "column": 5, - "index": 83910 - } - }, - "context": { - "loc": { - "start": { - "line": 94, - "column": 2, - "index": 2554 - }, - "end": { - "line": 2987, - "column": 4, - "index": 83792 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "x" - } - ], - "namespace": "x" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The y component of the vector" - } - ] - } - ] - }, - "tags": [ - { - "title": "type", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "for", - "description": "p5.Vector", - "lineNumber": 3 - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "y" - }, - { - "title": "name", - "description": null, - "lineNumber": 5, - "name": "y" - } - ], - "loc": { - "start": { - "line": 2997, - "column": 2, - "index": 83914 - }, - "end": { - "line": 3003, - "column": 5, - "index": 84028 - } - }, - "context": { - "loc": { - "start": { - "line": 94, - "column": 2, - "index": 2554 - }, - "end": { - "line": 2987, - "column": 4, - "index": 83792 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "y" - } - ], - "namespace": "y" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The z component of the vector" - } - ] - } - ] - }, - "tags": [ - { - "title": "type", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "for", - "description": "p5.Vector", - "lineNumber": 3 - }, - { - "title": "property", - "description": null, - "lineNumber": 4, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "z" - }, - { - "title": "name", - "description": null, - "lineNumber": 5, - "name": "z" - } - ], - "loc": { - "start": { - "line": 3005, - "column": 2, - "index": 84032 - }, - "end": { - "line": 3011, - "column": 5, - "index": 84146 - } - }, - "context": { - "loc": { - "start": { - "line": 94, - "column": 2, - "index": 2554 - }, - "end": { - "line": 2987, - "column": 4, - "index": 83792 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/p5.Vector.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "z" - } - ], - "namespace": "z" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the seed value for " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "random()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "randomGaussian()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". By default,\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "random()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "randomGaussian()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " produce different\nresults each time a sketch is run. Calling " - }, - { - "type": "inlineCode", - "value": "randomSeed()" - }, - { - "type": "text", - "value": " with a constant\nargument, such as " - }, - { - "type": "inlineCode", - "value": "randomSeed(99)" - }, - { - "type": "text", - "value": ", makes these functions produce the same\nresults each time a sketch is run." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "randomSeed" - }, - { - "title": "param", - "description": "seed value.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "seed" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 36, - "column": 2, - "index": 1137 - }, - "end": { - "line": 63, - "column": 5, - "index": 2031 - } - }, - "context": { - "loc": { - "start": { - "line": 64, - "column": 2, - "index": 2034 - }, - "end": { - "line": 67, - "column": 4, - "index": 2153 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/random.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "seed", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "seed value." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "randomSeed", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "randomSeed", - "kind": "function" - } - ], - "namespace": "randomSeed" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns a random number or a random element from an array." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "random()" - }, - { - "type": "text", - "value": " follows uniform distribution, which means that all outcomes are\nequally likely. When " - }, - { - "type": "inlineCode", - "value": "random()" - }, - { - "type": "text", - "value": " is used to generate numbers, all\nnumbers in the output range are equally likely to be returned. When\n" - }, - { - "type": "inlineCode", - "value": "random()" - }, - { - "type": "text", - "value": " is used to select elements from an array, all elements are\nequally likely to be chosen." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "By default, " - }, - { - "type": "inlineCode", - "value": "random()" - }, - { - "type": "text", - "value": " produces different results each time a sketch runs.\nThe " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "randomSeed()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function can be used to\ngenerate the same sequence of numbers or choices each time a sketch runs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "random()" - }, - { - "type": "text", - "value": " with no parameters returns a random number from 0\nup to but not including 1." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "random()" - }, - { - "type": "text", - "value": " with one parameter works one of two ways. If the\nargument passed is a number, " - }, - { - "type": "inlineCode", - "value": "random()" - }, - { - "type": "text", - "value": " returns a random number from 0 up\nto but not including the number. For example, calling " - }, - { - "type": "inlineCode", - "value": "random(5)" - }, - { - "type": "text", - "value": " returns\nvalues between 0 and 5. If the argument passed is an array, " - }, - { - "type": "inlineCode", - "value": "random()" - }, - { - "type": "text", - "value": "\nreturns a random element from that array. For example, calling\n" - }, - { - "type": "inlineCode", - "value": "random(['🦁', '🐯', '🐻'])" - }, - { - "type": "text", - "value": " returns either a lion, tiger, or bear emoji." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "random()" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "inlineCode", - "value": "random(-5, 10.2)" - }, - { - "type": "text", - "value": " returns values from -5 up to but\nnot including 10.2." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 28, - "name": "random" - }, - { - "title": "param", - "description": "lower bound (inclusive).", - "lineNumber": 29, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "min" - }, - { - "title": "param", - "description": "upper bound (exclusive).", - "lineNumber": 30, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "max" - }, - { - "title": "return", - "description": "random number.", - "lineNumber": 31, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 32 - } - ], - "loc": { - "start": { - "line": 69, - "column": 2, - "index": 2157 - }, - "end": { - "line": 157, - "column": 5, - "index": 4980 - } - }, - "context": { - "loc": { - "start": { - "line": 164, - "column": 2, - "index": 5130 - }, - "end": { - "line": 190, - "column": 4, - "index": 5750 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/random.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "min", - "lineNumber": 29, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "lower bound (inclusive)." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "max", - "lineNumber": 30, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "upper bound (exclusive)." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "random number." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "random", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "random", - "kind": "function" - } - ], - "namespace": "random" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "random" - }, - { - "title": "param", - "description": "array to choose from.", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "choices" - }, - { - "title": "return", - "description": "random element from the array.", - "lineNumber": 3, - "type": { - "type": "AllLiteral" - } - }, - { - "title": "example", - "description": "", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 158, - "column": 2, - "index": 4983 - }, - "end": { - "line": 163, - "column": 5, - "index": 5127 - } - }, - "context": { - "loc": { - "start": { - "line": 164, - "column": 2, - "index": 5130 - }, - "end": { - "line": 190, - "column": 4, - "index": 5750 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/random.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "choices", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "array to choose from." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "random element from the array." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "AllLiteral" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "random", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "random", - "kind": "function" - } - ], - "namespace": "random" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "By default, " - }, - { - "type": "inlineCode", - "value": "randomGaussian()" - }, - { - "type": "text", - "value": " produces different results each time a\nsketch runs. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "randomSeed()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function can be\nused to generate the same sequence of numbers each time a sketch runs." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "There's no minimum or maximum value that " - }, - { - "type": "inlineCode", - "value": "randomGaussian()" - }, - { - "type": "text", - "value": " might return.\nValues far from the mean are very unlikely and values near the mean are\nvery likely." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "randomGaussian()" - }, - { - "type": "text", - "value": " with no parameters returns values with a\nmean of 0 and standard deviation of 1." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "randomGaussian()" - }, - { - "type": "text", - "value": " with one parameter interprets the\nargument passed as the mean. The standard deviation is 1." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The version of " - }, - { - "type": "inlineCode", - "value": "randomGaussian()" - }, - { - "type": "text", - "value": " with two parameters interprets the first\nargument passed as the mean and the second as the standard deviation." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 23, - "name": "randomGaussian" - }, - { - "title": "param", - "description": "mean.", - "lineNumber": 24, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "mean" - }, - { - "title": "param", - "description": "standard deviation.", - "lineNumber": 25, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "sd" - }, - { - "title": "return", - "description": "random number.", - "lineNumber": 26, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 192, - "column": 2, - "index": 5754 - }, - "end": { - "line": 245, - "column": 5, - "index": 7725 - } - }, - "context": { - "loc": { - "start": { - "line": 246, - "column": 2, - "index": 7728 - }, - "end": { - "line": 265, - "column": 4, - "index": 8209 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/random.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "mean", - "lineNumber": 24, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "mean." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "sd", - "lineNumber": 25, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "standard deviation." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "random number." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "randomGaussian", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "randomGaussian", - "kind": "function" - } - ], - "namespace": "randomGaussian" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The inverse of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "cos()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", returns the arc cosine of a\nvalue. This function expects arguments in the range -1 to 1. By default,\n" - }, - { - "type": "inlineCode", - "value": "acos()" - }, - { - "type": "text", - "value": " returns values in the range 0 to π (about 3.14). If the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is " - }, - { - "type": "inlineCode", - "value": "DEGREES" - }, - { - "type": "text", - "value": ", then values are\nreturned in the range 0 to 180." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 7, - "name": "acos" - }, - { - "title": "param", - "description": "value whose arc cosine is to be returned.", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "value" - }, - { - "title": "return", - "description": "arc cosine of the given value.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 18, - "column": 2, - "index": 377 - }, - "end": { - "line": 55, - "column": 5, - "index": 1527 - } - }, - "context": { - "loc": { - "start": { - "line": 56, - "column": 2, - "index": 1530 - }, - "end": { - "line": 58, - "column": 4, - "index": 1610 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/trigonometry.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value whose arc cosine is to be returned." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "arc cosine of the given value." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "acos", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "acos", - "kind": "function" - } - ], - "namespace": "acos" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The inverse of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "sin()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", returns the arc sine of a\nvalue. This function expects input values in the range of -1 to 1. By\ndefault, " - }, - { - "type": "inlineCode", - "value": "asin()" - }, - { - "type": "text", - "value": " returns values in the range -π ÷ 2\n(about -1.57) to π ÷ 2 (about 1.57). If the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is " - }, - { - "type": "inlineCode", - "value": "DEGREES" - }, - { - "type": "text", - "value": " then values are\nreturned in the range -90 to 90." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "asin" - }, - { - "title": "param", - "description": "value whose arc sine is to be returned.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "value" - }, - { - "title": "return", - "description": "arc sine of the given value.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 60, - "column": 2, - "index": 1614 - }, - "end": { - "line": 98, - "column": 5, - "index": 2813 - } - }, - "context": { - "loc": { - "start": { - "line": 99, - "column": 2, - "index": 2816 - }, - "end": { - "line": 101, - "column": 4, - "index": 2896 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/trigonometry.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value whose arc sine is to be returned." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "arc sine of the given value." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "asin", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "asin", - "kind": "function" - } - ], - "namespace": "asin" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The inverse of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "tan()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", returns the arc tangent of a\nvalue. This function expects input values in the range of -Infinity to\nInfinity. By default, " - }, - { - "type": "inlineCode", - "value": "atan()" - }, - { - "type": "text", - "value": " returns values in the range -π ÷ 2\n(about -1.57) to π ÷ 2 (about 1.57). If the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is " - }, - { - "type": "inlineCode", - "value": "DEGREES" - }, - { - "type": "text", - "value": " then values are\nreturned in the range -90 to 90." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "atan" - }, - { - "title": "param", - "description": "value whose arc tangent is to be returned.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "value" - }, - { - "title": "return", - "description": "arc tangent of the given value.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 103, - "column": 2, - "index": 2900 - }, - "end": { - "line": 141, - "column": 5, - "index": 4120 - } - }, - "context": { - "loc": { - "start": { - "line": 142, - "column": 2, - "index": 4123 - }, - "end": { - "line": 144, - "column": 4, - "index": 4203 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/trigonometry.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value whose arc tangent is to be returned." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "arc tangent of the given value." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "atan", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "atan", - "kind": "function" - } - ], - "namespace": "atan" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates the angle formed by a specified point, the origin, and the\npositive x-axis. By default, " - }, - { - "type": "inlineCode", - "value": "atan2()" - }, - { - "type": "text", - "value": " returns values in the range\n-π (about -3.14) to π (3.14). If the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is " - }, - { - "type": "inlineCode", - "value": "DEGREES" - }, - { - "type": "text", - "value": ", then values are\nreturned in the range -180 to 180. The " - }, - { - "type": "inlineCode", - "value": "atan2()" - }, - { - "type": "text", - "value": " function is most often\nused for orienting geometry to the mouse's position." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The y-coordinate of the point is the first parameter and the\nx-coordinate is the second parameter." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 11, - "name": "atan2" - }, - { - "title": "param", - "description": "y-coordinate of the point.", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "x-coordinate of the point.", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "return", - "description": "arc tangent of the given point.", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 16 - } - ], - "loc": { - "start": { - "line": 146, - "column": 2, - "index": 4207 - }, - "end": { - "line": 178, - "column": 5, - "index": 5328 - } - }, - "context": { - "loc": { - "start": { - "line": 179, - "column": 2, - "index": 5331 - }, - "end": { - "line": 181, - "column": 4, - "index": 5411 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/trigonometry.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "y", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the point." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "arc tangent of the given point." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "atan2", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "atan2", - "kind": "function" - } - ], - "namespace": "atan2" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates the cosine of an angle. " - }, - { - "type": "inlineCode", - "value": "cos()" - }, - { - "type": "text", - "value": " is useful for many geometric\ntasks in creative coding. The values returned oscillate between -1 and 1\nas the input angle increases. " - }, - { - "type": "inlineCode", - "value": "cos()" - }, - { - "type": "text", - "value": " takes into account the current\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "cos" - }, - { - "title": "param", - "description": "the angle.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "angle" - }, - { - "title": "return", - "description": "cosine of the angle.", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 183, - "column": 2, - "index": 5415 - }, - "end": { - "line": 234, - "column": 5, - "index": 6667 - } - }, - "context": { - "loc": { - "start": { - "line": 235, - "column": 2, - "index": 6670 - }, - "end": { - "line": 237, - "column": 4, - "index": 6746 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/trigonometry.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "angle", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the angle." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "cosine of the angle." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "cos", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "cos", - "kind": "function" - } - ], - "namespace": "cos" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates the sine of an angle. " - }, - { - "type": "inlineCode", - "value": "sin()" - }, - { - "type": "text", - "value": " is useful for many geometric tasks\nin creative coding. The values returned oscillate between -1 and 1 as the\ninput angle increases. " - }, - { - "type": "inlineCode", - "value": "sin()" - }, - { - "type": "text", - "value": " takes into account the current\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "sin" - }, - { - "title": "param", - "description": "the angle.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "angle" - }, - { - "title": "return", - "description": "sine of the angle.", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 239, - "column": 2, - "index": 6750 - }, - "end": { - "line": 290, - "column": 5, - "index": 7995 - } - }, - "context": { - "loc": { - "start": { - "line": 291, - "column": 2, - "index": 7998 - }, - "end": { - "line": 293, - "column": 4, - "index": 8074 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/trigonometry.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "angle", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the angle." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "sine of the angle." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "sin", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "sin", - "kind": "function" - } - ], - "namespace": "sin" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calculates the tangent of an angle. " - }, - { - "type": "inlineCode", - "value": "tan()" - }, - { - "type": "text", - "value": " 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. " - }, - { - "type": "inlineCode", - "value": "tan()" - }, - { - "type": "text", - "value": "\ntakes into account the current " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "tan" - }, - { - "title": "param", - "description": "the angle.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "angle" - }, - { - "title": "return", - "description": "tangent of the angle.", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 295, - "column": 2, - "index": 8078 - }, - "end": { - "line": 317, - "column": 5, - "index": 8914 - } - }, - "context": { - "loc": { - "start": { - "line": 318, - "column": 2, - "index": 8917 - }, - "end": { - "line": 320, - "column": 4, - "index": 8993 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/trigonometry.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "angle", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the angle." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "tangent of the angle." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "tan", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "tan", - "kind": "function" - } - ], - "namespace": "tan" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "degrees" - }, - { - "title": "param", - "description": "radians value to convert to degrees.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "radians" - }, - { - "title": "return", - "description": "converted angle.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 322, - "column": 2, - "index": 8997 - }, - "end": { - "line": 344, - "column": 5, - "index": 9782 - } - }, - "context": { - "loc": { - "start": { - "line": 345, - "column": 2, - "index": 9785 - }, - "end": { - "line": 345, - "column": 53, - "index": 9836 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/trigonometry.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "radians", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "radians value to convert to degrees." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "converted angle." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "degrees", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "degrees", - "kind": "function" - } - ], - "namespace": "degrees" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "radians" - }, - { - "title": "param", - "description": "degree value to convert to radians.", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "degrees" - }, - { - "title": "return", - "description": "converted angle.", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 347, - "column": 2, - "index": 9840 - }, - "end": { - "line": 369, - "column": 5, - "index": 10617 - } - }, - "context": { - "loc": { - "start": { - "line": 370, - "column": 2, - "index": 10620 - }, - "end": { - "line": 370, - "column": 53, - "index": 10671 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/trigonometry.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "degrees", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "degree value to convert to radians." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "converted angle." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "radians", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "radians", - "kind": "function" - } - ], - "namespace": "radians" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Changes the way trigonometric functions interpret angle values. By default,\nthe mode is " - }, - { - "type": "inlineCode", - "value": "RADIANS" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "inlineCode", - "value": "angleMode()" - }, - { - "type": "text", - "value": " with no arguments returns current angle mode." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "angleMode" - }, - { - "title": "param", - "description": "either RADIANS or DEGREES.", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "RADIANS" - }, - { - "type": "NameExpression", - "name": "DEGREES" - } - ] - }, - "name": "mode" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 372, - "column": 2, - "index": 10675 - }, - "end": { - "line": 400, - "column": 5, - "index": 11451 - } - }, - "context": { - "loc": { - "start": { - "line": 405, - "column": 2, - "index": 11553 - }, - "end": { - "line": 431, - "column": 4, - "index": 12671 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/trigonometry.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "mode", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either RADIANS or DEGREES." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "RADIANS" - }, - { - "type": "NameExpression", - "name": "DEGREES" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "angleMode", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "angleMode", - "kind": "function" - } - ], - "namespace": "angleMode" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "angleMode" - }, - { - "title": "return", - "description": "mode either RADIANS or DEGREES", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "RADIANS" - }, - { - "type": "NameExpression", - "name": "DEGREES" - } - ] - } - } - ], - "loc": { - "start": { - "line": 401, - "column": 2, - "index": 11454 - }, - "end": { - "line": 404, - "column": 5, - "index": 11550 - } - }, - "context": { - "loc": { - "start": { - "line": 405, - "column": 2, - "index": 11553 - }, - "end": { - "line": 431, - "column": 4, - "index": 12671 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/math/trigonometry.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "mode either RADIANS or DEGREES" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "RADIANS" - }, - { - "type": "NameExpression", - "name": "DEGREES" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "angleMode", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "angleMode", - "kind": "function" - } - ], - "namespace": "angleMode" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Typography" - }, - { - "title": "submodule", - "description": "Attributes", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - }, - { - "title": "requires", - "description": null, - "lineNumber": 5, - "name": "constants" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 7, - "column": 3, - "index": 106 - } - }, - "context": { - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 108 - }, - "end": { - "line": 9, - "column": 30, - "index": 138 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Typography", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Typography", - "kind": "module" - } - ], - "namespace": "Typography" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "Typography" - }, - { - "title": "submodule", - "description": "Loading & Displaying", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 93 - } - }, - "context": { - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 95 - }, - "end": { - "line": 8, - "column": 30, - "index": 125 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/loading_displaying.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Typography", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Typography", - "kind": "module" - } - ], - "namespace": "Typography" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This module defines the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Font" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " class and functions for\ndrawing text to the display canvas." - } - ] - } - ] - }, - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 3, - "type": null, - "name": "Typography" - }, - { - "title": "submodule", - "description": "Loading & Displaying", - "lineNumber": 4 - }, - { - "title": "requires", - "description": null, - "lineNumber": 5, - "name": "core" - }, - { - "title": "requires", - "description": null, - "lineNumber": 6, - "name": "constants" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 8, - "column": 3, - "index": 227 - } - }, - "context": { - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 229 - }, - "end": { - "line": 10, - "column": 30, - "index": 259 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/p5.Font.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "Typography", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "Typography", - "kind": "module" - } - ], - "namespace": "Typography" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the way text is aligned when " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "text()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is called." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "By default, calling " - }, - { - "type": "inlineCode", - "value": "text('hi', 10, 20)" - }, - { - "type": "text", - "value": " places the bottom-left corner of\nthe text's bounding box at (10, 20)." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "horizAlign" - }, - { - "type": "text", - "value": ", changes the way\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "text()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " interprets x-coordinates. By default, the\nx-coordinate sets the left edge of the bounding box. " - }, - { - "type": "inlineCode", - "value": "textAlign()" - }, - { - "type": "text", - "value": " accepts\nthe following values for " - }, - { - "type": "inlineCode", - "value": "horizAlign" - }, - { - "type": "text", - "value": ": " - }, - { - "type": "inlineCode", - "value": "LEFT" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "CENTER" - }, - { - "type": "text", - "value": ", or " - }, - { - "type": "inlineCode", - "value": "RIGHT" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "vertAlign" - }, - { - "type": "text", - "value": ", is optional. It changes the way\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "text()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " interprets y-coordinates. By default, the\ny-coordinate sets the bottom edge of the bounding box. " - }, - { - "type": "inlineCode", - "value": "textAlign()" - }, - { - "type": "text", - "value": "\naccepts the following values for " - }, - { - "type": "inlineCode", - "value": "vertAlign" - }, - { - "type": "text", - "value": ": " - }, - { - "type": "inlineCode", - "value": "TOP" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "BOTTOM" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "CENTER" - }, - { - "type": "text", - "value": ",\nor " - }, - { - "type": "inlineCode", - "value": "BASELINE" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 17, - "name": "textAlign" - }, - { - "title": "param", - "description": "horizontal alignment, either LEFT,\n CENTER, or RIGHT.", - "lineNumber": 18, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "CENTER" - }, - { - "type": "NameExpression", - "name": "RIGHT" - } - ] - }, - "name": "horizAlign" - }, - { - "title": "param", - "description": "vertical alignment, either TOP,\n BOTTOM, CENTER, or BASELINE.", - "lineNumber": 20, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "TOP" - }, - { - "type": "NameExpression", - "name": "BOTTOM" - }, - { - "type": "NameExpression", - "name": "BASELINE" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - } - }, - "name": "vertAlign" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 22 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 23 - } - ], - "loc": { - "start": { - "line": 11, - "column": 0, - "index": 140 - }, - "end": { - "line": 75, - "column": 3, - "index": 2237 - } - }, - "context": { - "loc": { - "start": { - "line": 80, - "column": 0, - "index": 2287 - }, - "end": { - "line": 83, - "column": 2, - "index": 2447 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "horizAlign", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "horizontal alignment, either LEFT,\nCENTER, or RIGHT." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "LEFT" - }, - { - "type": "NameExpression", - "name": "CENTER" - }, - { - "type": "NameExpression", - "name": "RIGHT" - } - ] - } - }, - { - "title": "param", - "name": "vertAlign", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "vertical alignment, either TOP,\nBOTTOM, CENTER, or BASELINE." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "TOP" - }, - { - "type": "NameExpression", - "name": "BOTTOM" - }, - { - "type": "NameExpression", - "name": "BASELINE" - }, - { - "type": "NameExpression", - "name": "CENTER" - } - ] - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "textAlign", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "textAlign", - "kind": "function" - } - ], - "namespace": "textAlign" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "textAlign" - }, - { - "title": "return", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "loc": { - "start": { - "line": 76, - "column": 0, - "index": 2238 - }, - "end": { - "line": 79, - "column": 3, - "index": 2286 - } - }, - "context": { - "loc": { - "start": { - "line": 80, - "column": 0, - "index": 2287 - }, - "end": { - "line": 83, - "column": 2, - "index": 2447 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "textAlign", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "textAlign", - "kind": "function" - } - ], - "namespace": "textAlign" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the spacing between lines of text when\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "text()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is called. Spacing is measured in pixels." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "inlineCode", - "value": "textLeading()" - }, - { - "type": "text", - "value": " without an argument returns the current spacing." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "textLeading" - }, - { - "title": "param", - "description": "spacing between lines of text in units of pixels.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "leading" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 85, - "column": 0, - "index": 2449 - }, - "end": { - "line": 109, - "column": 3, - "index": 3125 - } - }, - "context": { - "loc": { - "start": { - "line": 114, - "column": 0, - "index": 3177 - }, - "end": { - "line": 117, - "column": 2, - "index": 3332 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "leading", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "spacing between lines of text in units of pixels." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "textLeading", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "textLeading", - "kind": "function" - } - ], - "namespace": "textLeading" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "textLeading" - }, - { - "title": "return", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "loc": { - "start": { - "line": 110, - "column": 0, - "index": 3126 - }, - "end": { - "line": 113, - "column": 3, - "index": 3176 - } - }, - "context": { - "loc": { - "start": { - "line": 114, - "column": 0, - "index": 3177 - }, - "end": { - "line": 117, - "column": 2, - "index": 3332 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "textLeading", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "textLeading", - "kind": "function" - } - ], - "namespace": "textLeading" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the font size when\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "text()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is called. Font size is measured in pixels." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "inlineCode", - "value": "textSize()" - }, - { - "type": "text", - "value": " without an arugment returns the current size." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "textSize" - }, - { - "title": "param", - "description": "size of the letters in units of pixels", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "size" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 119, - "column": 0, - "index": 3334 - }, - "end": { - "line": 142, - "column": 3, - "index": 3941 - } - }, - "context": { - "loc": { - "start": { - "line": 147, - "column": 0, - "index": 3990 - }, - "end": { - "line": 150, - "column": 2, - "index": 4133 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "size", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "size of the letters in units of pixels" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "textSize", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "textSize", - "kind": "function" - } - ], - "namespace": "textSize" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "textSize" - }, - { - "title": "return", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "loc": { - "start": { - "line": 143, - "column": 0, - "index": 3942 - }, - "end": { - "line": 146, - "column": 3, - "index": 3989 - } - }, - "context": { - "loc": { - "start": { - "line": 147, - "column": 0, - "index": 3990 - }, - "end": { - "line": 150, - "column": 2, - "index": 4133 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "textSize", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "textSize", - "kind": "function" - } - ], - "namespace": "textSize" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the style for system fonts when\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "text()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is called. " - }, - { - "type": "inlineCode", - "value": "textStyle()" - }, - { - "type": "text", - "value": " accepts the\nfollowing values: " - }, - { - "type": "inlineCode", - "value": "NORMAL" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "ITALIC" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "BOLD" - }, - { - "type": "text", - "value": " or " - }, - { - "type": "inlineCode", - "value": "BOLDITALIC" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "textStyle()" - }, - { - "type": "text", - "value": " may be overridden by CSS styling. This function doesn't\naffect fonts loaded with " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadFont()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "textStyle" - }, - { - "title": "param", - "description": "styling for text, either NORMAL,\n ITALIC, BOLD or BOLDITALIC", - "lineNumber": 9, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "NORMAL" - }, - { - "type": "NameExpression", - "name": "ITALIC" - }, - { - "type": "NameExpression", - "name": "BOLD" - }, - { - "type": "NameExpression", - "name": "BOLDITALIC" - } - ] - }, - "name": "style" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 152, - "column": 0, - "index": 4135 - }, - "end": { - "line": 182, - "column": 3, - "index": 5064 - } - }, - "context": { - "loc": { - "start": { - "line": 187, - "column": 0, - "index": 5114 - }, - "end": { - "line": 190, - "column": 2, - "index": 5261 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "style", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "styling for text, either NORMAL,\nITALIC, BOLD or BOLDITALIC" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "NORMAL" - }, - { - "type": "NameExpression", - "name": "ITALIC" - }, - { - "type": "NameExpression", - "name": "BOLD" - }, - { - "type": "NameExpression", - "name": "BOLDITALIC" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "textStyle", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "textStyle", - "kind": "function" - } - ], - "namespace": "textStyle" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "textStyle" - }, - { - "title": "return", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "loc": { - "start": { - "line": 183, - "column": 0, - "index": 5065 - }, - "end": { - "line": 186, - "column": 3, - "index": 5113 - } - }, - "context": { - "loc": { - "start": { - "line": 187, - "column": 0, - "index": 5114 - }, - "end": { - "line": 190, - "column": 2, - "index": 5261 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "textStyle", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "textStyle", - "kind": "function" - } - ], - "namespace": "textStyle" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the maximum width of a string of text drawn when\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "text()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is called." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "textWidth" - }, - { - "title": "param", - "description": "string of text to measure.", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "str" - }, - { - "title": "return", - "description": "width measured in units of pixels.", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 192, - "column": 0, - "index": 5263 - }, - "end": { - "line": 234, - "column": 3, - "index": 6196 - } - }, - "context": { - "loc": { - "start": { - "line": 235, - "column": 0, - "index": 6197 - }, - "end": { - "line": 256, - "column": 2, - "index": 6779 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "str", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "string of text to measure." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "width measured in units of pixels." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "textWidth", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "textWidth", - "kind": "function" - } - ], - "namespace": "textWidth" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "textAscent" - }, - { - "title": "return", - "description": "ascent measured in units of pixels.", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 258, - "column": 0, - "index": 6781 - }, - "end": { - "line": 304, - "column": 3, - "index": 7975 - } - }, - "context": { - "loc": { - "start": { - "line": 305, - "column": 0, - "index": 7976 - }, - "end": { - "line": 308, - "column": 2, - "index": 8108 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ascent measured in units of pixels." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "textAscent", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "textAscent", - "kind": "function" - } - ], - "namespace": "textAscent" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "textDescent" - }, - { - "title": "return", - "description": "descent measured in units of pixels.", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 310, - "column": 0, - "index": 8110 - }, - "end": { - "line": 356, - "column": 3, - "index": 9336 - } - }, - "context": { - "loc": { - "start": { - "line": 357, - "column": 0, - "index": 9337 - }, - "end": { - "line": 360, - "column": 2, - "index": 9472 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "descent measured in units of pixels." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "textDescent", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "textDescent", - "kind": "function" - } - ], - "namespace": "textDescent" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the style for wrapping text when\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "text()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is called. " - }, - { - "type": "inlineCode", - "value": "textWrap()" - }, - { - "type": "text", - "value": " accepts the\nfollowing values:" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "WORD" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "CHAR" - }, - { - "type": "text", - "value": " starts new lines as needed to stay within the text box." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "textWrap()" - }, - { - "type": "text", - "value": " only works when the maximum width is set for a text box. For\nexample, calling " - }, - { - "type": "inlineCode", - "value": "text('Have a wonderful day', 0, 10, 100)" - }, - { - "type": "text", - "value": " sets the\nmaximum width to 100 pixels." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Calling " - }, - { - "type": "inlineCode", - "value": "textWrap()" - }, - { - "type": "text", - "value": " without an argument returns the current style." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 17, - "name": "textWrap" - }, - { - "title": "param", - "description": "text wrapping style, either WORD or CHAR.", - "lineNumber": 18, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WORD" - }, - { - "type": "NameExpression", - "name": "CHAR" - } - ] - }, - "name": "style" - }, - { - "title": "return", - "description": "style", - "lineNumber": 19, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 20 - } - ], - "loc": { - "start": { - "line": 369, - "column": 0, - "index": 9629 - }, - "end": { - "line": 413, - "column": 3, - "index": 10753 - } - }, - "context": { - "loc": { - "start": { - "line": 414, - "column": 0, - "index": 10754 - }, - "end": { - "line": 419, - "column": 2, - "index": 10960 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/attributes.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "style", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "text wrapping style, either WORD or CHAR." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "WORD" - }, - { - "type": "NameExpression", - "name": "CHAR" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "style" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "textWrap", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "textWrap", - "kind": "function" - } - ], - "namespace": "textWrap" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Loads a font and creates a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Font" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object.\n" - }, - { - "type": "inlineCode", - "value": "loadFont()" - }, - { - "type": "text", - "value": " can load fonts in either .otf or .ttf format. Loaded fonts can\nbe used to style text on the canvas and in HTML elements." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "path" - }, - { - "type": "text", - "value": ", is the path to a font file.\nPaths to local files should be relative. For example,\n" - }, - { - "type": "inlineCode", - "value": "'assets/inconsolata.otf'" - }, - { - "type": "text", - "value": ". The Inconsolata font used in the following\nexamples can be downloaded for free\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "here" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nPaths to remote files should be URLs. For example,\n" - }, - { - "type": "inlineCode", - "value": "'https://example.com/inconsolata.otf'" - }, - { - "type": "text", - "value": ". URLs may be blocked due to browser\nsecurity." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "successCallback" - }, - { - "type": "text", - "value": ", is optional. If a function is\npassed, it will be called once the font has loaded. The callback function\nmay use the new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Font" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object if needed." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The third parameter, " - }, - { - "type": "inlineCode", - "value": "failureCallback" - }, - { - "type": "text", - "value": ", 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\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Event" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nobject if needed." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Fonts can take time to load. Calling " - }, - { - "type": "inlineCode", - "value": "loadFont()" - }, - { - "type": "text", - "value": " in\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "preload()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " ensures fonts load before they're\nused in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setup()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "draw()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 29, - "name": "loadFont" - }, - { - "title": "param", - "description": "path of the font to be loaded.", - "lineNumber": 30, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "path" - }, - { - "title": "param", - "description": "function called with the\n p5.Font object after it\n loads.", - "lineNumber": 31, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Function" - } - }, - "name": "successCallback" - }, - { - "title": "param", - "description": "function called with the error\n Event\n object if the font fails to load.", - "lineNumber": 34, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Function" - } - }, - "name": "failureCallback" - }, - { - "title": "return", - "description": "p5.Font object.", - "lineNumber": 37, - "type": { - "type": "NameExpression", - "name": "p5.Font" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 38 - } - ], - "loc": { - "start": { - "line": 16, - "column": 0, - "index": 356 - }, - "end": { - "line": 128, - "column": 3, - "index": 3910 - } - }, - "context": { - "loc": { - "start": { - "line": 129, - "column": 0, - "index": 3911 - }, - "end": { - "line": 180, - "column": 2, - "index": 5288 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/loading_displaying.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "path", - "lineNumber": 30, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "path of the font to be loaded." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "successCallback", - "lineNumber": 31, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function called with the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Font" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object after it\nloads." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Function" - } - } - }, - { - "title": "param", - "name": "failureCallback", - "lineNumber": 34, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function called with the error\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Event" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nobject if the font fails to load." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Function" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Font" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Font" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "loadFont", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "loadFont", - "kind": "function" - } - ], - "namespace": "loadFont" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Draws text to the canvas." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "str" - }, - { - "type": "text", - "value": ", is the text to be drawn. The second and third\nparameters, " - }, - { - "type": "inlineCode", - "value": "x" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "y" - }, - { - "type": "text", - "value": ", set the coordinates of the text's bottom-left\ncorner. See " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "textAlign()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for other ways to\nalign text." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The fourth and fifth parameters, " - }, - { - "type": "inlineCode", - "value": "maxWidth" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "maxHeight" - }, - { - "type": "text", - "value": ", are optional.\nThey set the dimensions of the invisible rectangle containing the text. By\ndefault, they set its maximum width and height. See\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "rectMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Text can be styled a few ways. Call the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "fill()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfunction to set the text's fill color. Call\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "stroke()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "strokeWeight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to set the text's outline.\nCall " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "textSize()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "textFont()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to set the text's size and font,\nrespectively." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: " - }, - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " mode only supports fonts loaded with\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadFont()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". Calling\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "stroke()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " has no effect in " - }, - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " mode." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 27, - "name": "text" - }, - { - "title": "param", - "description": "text to be displayed.", - "lineNumber": 28, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "Array" - }, - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - }, - "name": "str" - }, - { - "title": "param", - "description": "x-coordinate of the text box.", - "lineNumber": 29, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y-coordinate of the text box.", - "lineNumber": 30, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "maximum width of the text box. See\n rectMode() for\n other options.", - "lineNumber": 31, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "maxWidth" - }, - { - "title": "param", - "description": "maximum height of the text box. See\n rectMode() for\n other options.", - "lineNumber": 34, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "maxHeight" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 38 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 39 - } - ], - "loc": { - "start": { - "line": 182, - "column": 0, - "index": 5290 - }, - "end": { - "line": 327, - "column": 3, - "index": 9255 - } - }, - "context": { - "loc": { - "start": { - "line": 328, - "column": 0, - "index": 9256 - }, - "end": { - "line": 333, - "column": 2, - "index": 9481 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/loading_displaying.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "str", - "lineNumber": 28, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "text to be displayed." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "Array" - }, - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "Boolean" - } - ] - } - }, - { - "title": "param", - "name": "x", - "lineNumber": 29, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-coordinate of the text box." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 30, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-coordinate of the text box." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "maxWidth", - "lineNumber": 31, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "maximum width of the text box. See\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "rectMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for\nother options." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "maxHeight", - "lineNumber": 34, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "maximum height of the text box. See\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "rectMode()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for\nother options." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "text", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "text", - "kind": "function" - } - ], - "namespace": "text" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the font used by the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "text()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The first parameter, " - }, - { - "type": "inlineCode", - "value": "font" - }, - { - "type": "text", - "value": ", sets the font. " - }, - { - "type": "inlineCode", - "value": "textFont()" - }, - { - "type": "text", - "value": " recognizes either\na " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Font" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object or a string with the name of a\nsystem font. For example, " - }, - { - "type": "inlineCode", - "value": "'Courier New'" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The second parameter, " - }, - { - "type": "inlineCode", - "value": "size" - }, - { - "type": "text", - "value": ", is optional. It sets the font size in pixels.\nThis has the same effect as calling " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "textSize()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: " - }, - { - "type": "inlineCode", - "value": "WEBGL" - }, - { - "type": "text", - "value": " mode only supports fonts loaded with\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadFont()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 13, - "name": "textFont" - }, - { - "title": "return", - "description": "current font or p5 Object.", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 16 - } - ], - "loc": { - "start": { - "line": 335, - "column": 0, - "index": 9483 - }, - "end": { - "line": 417, - "column": 3, - "index": 11702 - } - }, - "context": { - "loc": { - "start": { - "line": 424, - "column": 0, - "index": 11885 - }, - "end": { - "line": 448, - "column": 2, - "index": 12563 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/loading_displaying.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "current font or p5 Object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "textFont", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "textFont", - "kind": "function" - } - ], - "namespace": "textFont" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "textFont" - }, - { - "title": "param", - "description": "font as a p5.Font object or a string.", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "font" - }, - { - "title": "param", - "description": "font size in pixels.", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "size" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 418, - "column": 0, - "index": 11703 - }, - "end": { - "line": 423, - "column": 3, - "index": 11884 - } - }, - "context": { - "loc": { - "start": { - "line": 424, - "column": 0, - "index": 11885 - }, - "end": { - "line": 448, - "column": 2, - "index": 12563 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/loading_displaying.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "font", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "font as a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Font" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object or a string." - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Object" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "param", - "name": "size", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "font size in pixels." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "textFont", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "textFont", - "kind": "function" - } - ], - "namespace": "textFont" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A class to describe fonts." - } - ] - } - ] - }, - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 2, - "type": null, - "name": "p5.Font" - }, - { - "title": "param", - "description": "pointer to p5 instance.", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5" - } - }, - "name": "pInst" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 13, - "column": 0, - "index": 309 - }, - "end": { - "line": 37, - "column": 3, - "index": 788 - } - }, - "context": { - "loc": { - "start": { - "line": 38, - "column": 0, - "index": 789 - }, - "end": { - "line": 564, - "column": 2, - "index": 15837 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/p5.Font.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "pInst", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "pointer to p5 instance." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "p5" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "class", - "name": "p5.Font", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.Font", - "kind": "class" - } - ], - "namespace": "p5.Font" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Underlying\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "opentype.js" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nfont object." - } - ] - } - ] - }, - "tags": [ - { - "title": "for", - "description": "p5.Font", - "lineNumber": 4 - }, - { - "title": "property", - "description": null, - "lineNumber": 5, - "type": null, - "errors": [ - "Missing or invalid tag type" - ], - "name": "font" - }, - { - "title": "name", - "description": null, - "lineNumber": 6, - "name": "font" - } - ], - "loc": { - "start": { - "line": 566, - "column": 0, - "index": 15839 - }, - "end": { - "line": 573, - "column": 3, - "index": 15994 - } - }, - "context": { - "loc": { - "start": { - "line": 577, - "column": 0, - "index": 16011 - }, - "end": { - "line": 597, - "column": 1, - "index": 16433 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/typography/p5.Font.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "font", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "font" - } - ], - "namespace": "font" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Adds a value to the end of an array. Extends the length of\nthe array by one. Maps to Array.push()." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "append" - }, - { - "title": "deprecated", - "description": "Use array.push(value) instead.", - "lineNumber": 5 - }, - { - "title": "param", - "description": "Array to append", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "array" - }, - { - "title": "param", - "description": "to be added to the Array", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "any" - }, - "name": "value" - }, - { - "title": "return", - "description": "the array that was appended to", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 116 - }, - "end": { - "line": 29, - "column": 3, - "index": 824 - } - }, - "context": { - "loc": { - "start": { - "line": 30, - "column": 0, - "index": 825 - }, - "end": { - "line": 33, - "column": 2, - "index": 911 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/array_functions.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "array", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array to append" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "to be added to the Array" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "any" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the array that was appended to" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "append", - "deprecated": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "array.push(value)" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " instead." - } - ] - } - ] - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "append", - "kind": "function" - } - ], - "namespace": "append" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "concat()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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)." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Using this function is far more efficient for copying array data than\niterating through a for() loop and copying each element individually." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 15, - "name": "arrayCopy" - }, - { - "title": "deprecated", - "description": "Use arr1.copyWithin(arr2) instead.", - "lineNumber": 16 - }, - { - "title": "param", - "description": "the source Array", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "src" - }, - { - "title": "param", - "description": "starting position in the source Array", - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "srcPosition" - }, - { - "title": "param", - "description": "the destination Array", - "lineNumber": 19, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "dst" - }, - { - "title": "param", - "description": "starting position in the destination Array", - "lineNumber": 20, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "dstPosition" - }, - { - "title": "param", - "description": "number of Array elements to be copied", - "lineNumber": 21, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "length" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 23 - } - ], - "loc": { - "start": { - "line": 35, - "column": 0, - "index": 913 - }, - "end": { - "line": 72, - "column": 3, - "index": 2556 - } - }, - "context": { - "loc": { - "start": { - "line": 80, - "column": 0, - "index": 2823 - }, - "end": { - "line": 110, - "column": 2, - "index": 3709 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/array_functions.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "src", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the source Array" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "param", - "name": "srcPosition", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "starting position in the source Array" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "dst", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the destination Array" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "param", - "name": "dstPosition", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "starting position in the destination Array" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "length", - "lineNumber": 21, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of Array elements to be copied" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "arrayCopy", - "deprecated": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "arr1.copyWithin(arr2)" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " instead." - } - ] - } - ] - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "arrayCopy", - "kind": "function" - } - ], - "namespace": "arrayCopy" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "arrayCopy" - }, - { - "title": "deprecated", - "description": "Use arr1.copyWithin(arr2) instead.", - "lineNumber": 2 - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "src" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "dst" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "length" - } - ], - "loc": { - "start": { - "line": 73, - "column": 0, - "index": 2557 - }, - "end": { - "line": 79, - "column": 3, - "index": 2822 - } - }, - "context": { - "loc": { - "start": { - "line": 80, - "column": 0, - "index": 2823 - }, - "end": { - "line": 110, - "column": 2, - "index": 3709 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/array_functions.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "src", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "param", - "name": "dst", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "param", - "name": "length", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "arrayCopy", - "deprecated": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "arr1.copyWithin(arr2)" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " instead." - } - ] - } - ] - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "arrayCopy", - "kind": "function" - } - ], - "namespace": "arrayCopy" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Concatenates two arrays, maps to Array.concat(). Does not modify the\ninput arrays." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "concat" - }, - { - "title": "deprecated", - "description": "Use arr1.concat(arr2) instead.", - "lineNumber": 5 - }, - { - "title": "param", - "description": "first Array to concatenate", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "a" - }, - { - "title": "param", - "description": "second Array to concatenate", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "b" - }, - { - "title": "return", - "description": "concatenated array", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 112, - "column": 0, - "index": 3711 - }, - "end": { - "line": 138, - "column": 3, - "index": 4487 - } - }, - "context": { - "loc": { - "start": { - "line": 139, - "column": 0, - "index": 4488 - }, - "end": { - "line": 139, - "column": 60, - "index": 4548 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/array_functions.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "a", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "first Array to concatenate" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "param", - "name": "b", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "second Array to concatenate" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "concatenated array" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "concat", - "deprecated": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "arr1.concat(arr2)" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " instead." - } - ] - } - ] - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "concat", - "kind": "function" - } - ], - "namespace": "concat" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Reverses the order of an array, maps to Array.reverse()" - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 3, - "name": "reverse" - }, - { - "title": "deprecated", - "description": "Use array.reverse() instead.", - "lineNumber": 4 - }, - { - "title": "param", - "description": "Array to reverse", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "list" - }, - { - "title": "return", - "description": "the reversed list", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 141, - "column": 0, - "index": 4550 - }, - "end": { - "line": 158, - "column": 3, - "index": 5094 - } - }, - "context": { - "loc": { - "start": { - "line": 159, - "column": 0, - "index": 5095 - }, - "end": { - "line": 159, - "column": 46, - "index": 5141 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/array_functions.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "list", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array to reverse" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the reversed list" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "reverse", - "deprecated": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "array.reverse()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " instead." - } - ] - } - ] - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "reverse", - "kind": "function" - } - ], - "namespace": "reverse" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Decreases an array by one element and returns the shortened array,\nmaps to Array.pop()." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "shorten" - }, - { - "title": "deprecated", - "description": "Use array.pop() instead.", - "lineNumber": 5 - }, - { - "title": "param", - "description": "Array to shorten", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "list" - }, - { - "title": "return", - "description": "shortened Array", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 161, - "column": 0, - "index": 5143 - }, - "end": { - "line": 179, - "column": 3, - "index": 5764 - } - }, - "context": { - "loc": { - "start": { - "line": 180, - "column": 0, - "index": 5765 - }, - "end": { - "line": 183, - "column": 2, - "index": 5836 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/array_functions.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "list", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array to shorten" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "shortened Array" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "shorten", - "deprecated": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "array.pop()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " instead." - } - ] - } - ] - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "shorten", - "kind": "function" - } - ], - "namespace": "shorten" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Randomizes the order of the elements of an array. Implements\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nFisher-Yates Shuffle Algorithm" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "shuffle" - }, - { - "title": "param", - "description": "Array to shuffle", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "array" - }, - { - "title": "param", - "description": "modify passed array", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - }, - "name": "bool" - }, - { - "title": "return", - "description": "shuffled Array", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 185, - "column": 0, - "index": 5838 - }, - "end": { - "line": 208, - "column": 3, - "index": 6567 - } - }, - "context": { - "loc": { - "start": { - "line": 209, - "column": 0, - "index": 6568 - }, - "end": { - "line": 225, - "column": 2, - "index": 6929 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/array_functions.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "array", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array to shuffle" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "param", - "name": "bool", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "modify passed array" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "shuffled Array" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "shuffle", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "shuffle", - "kind": "function" - } - ], - "namespace": "shuffle" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 7, - "name": "sort" - }, - { - "title": "deprecated", - "description": "Use array.sort() instead.", - "lineNumber": 8 - }, - { - "title": "param", - "description": "Array to sort", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "list" - }, - { - "title": "param", - "description": "number of elements to sort, starting from 0", - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "count" - }, - { - "title": "return", - "description": "the sorted list", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - } - ], - "loc": { - "start": { - "line": 227, - "column": 0, - "index": 6931 - }, - "end": { - "line": 261, - "column": 3, - "index": 8274 - } - }, - "context": { - "loc": { - "start": { - "line": 262, - "column": 0, - "index": 8275 - }, - "end": { - "line": 271, - "column": 2, - "index": 8600 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/array_functions.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "list", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array to sort" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "param", - "name": "count", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of elements to sort, starting from 0" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the sorted list" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "sort", - "deprecated": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "array.sort()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " instead." - } - ] - } - ] - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "sort", - "kind": "function" - } - ], - "namespace": "sort" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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.)" - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "splice" - }, - { - "title": "deprecated", - "description": "Use array.splice() instead.", - "lineNumber": 9 - }, - { - "title": "param", - "description": "Array to splice into", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "list" - }, - { - "title": "param", - "description": "value to be spliced in", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "any" - }, - "name": "value" - }, - { - "title": "param", - "description": "in the array from which to insert data", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "position" - }, - { - "title": "return", - "description": "the list", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 15 - } - ], - "loc": { - "start": { - "line": 273, - "column": 0, - "index": 8602 - }, - "end": { - "line": 300, - "column": 3, - "index": 9722 - } - }, - "context": { - "loc": { - "start": { - "line": 301, - "column": 0, - "index": 9723 - }, - "end": { - "line": 306, - "column": 2, - "index": 9922 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/array_functions.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "list", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array to splice into" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to be spliced in" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "any" - } - }, - { - "title": "param", - "name": "position", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "in the array from which to insert data" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the list" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "splice", - "deprecated": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "array.splice()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " instead." - } - ] - } - ] - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "splice", - "kind": "function" - } - ], - "namespace": "splice" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "subset" - }, - { - "title": "deprecated", - "description": "Use array.slice() instead.", - "lineNumber": 9 - }, - { - "title": "param", - "description": "Array to extract from", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "list" - }, - { - "title": "param", - "description": "position to begin", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Integer" - }, - "name": "start" - }, - { - "title": "param", - "description": "number of values to extract", - "lineNumber": 12, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "count" - }, - { - "title": "return", - "description": "Array of extracted elements", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 15 - } - ], - "loc": { - "start": { - "line": 308, - "column": 0, - "index": 9924 - }, - "end": { - "line": 335, - "column": 3, - "index": 11044 - } - }, - "context": { - "loc": { - "start": { - "line": 336, - "column": 0, - "index": 11045 - }, - "end": { - "line": 342, - "column": 2, - "index": 11241 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/array_functions.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "list", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array to extract from" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "param", - "name": "start", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "position to begin" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "param", - "name": "count", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of values to extract" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of extracted elements" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "subset", - "deprecated": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "array.slice()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " instead." - } - ] - } - ] - }, - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "subset", - "kind": "function" - } - ], - "namespace": "subset" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "When an array of values is passed in, then an array of floats of the same\nlength is returned." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "float" - }, - { - "title": "param", - "description": "float string to parse", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "str" - }, - { - "title": "return", - "description": "floating point representation of string", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 111 - }, - "end": { - "line": 34, - "column": 3, - "index": 981 - } - }, - "context": { - "loc": { - "start": { - "line": 35, - "column": 0, - "index": 982 - }, - "end": { - "line": 40, - "column": 2, - "index": 1113 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/conversion.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "str", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "float string to parse" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "floating point representation of string" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "float", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "float", - "kind": "function" - } - ], - "namespace": "float" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "int" - }, - { - "title": "param", - "description": "value to parse", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Boolean" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "n" - }, - { - "title": "param", - "description": "the radix to convert to (default: 10)", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "radix" - }, - { - "title": "return", - "description": "integer representation of value", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 42, - "column": 0, - "index": 1115 - }, - "end": { - "line": 63, - "column": 3, - "index": 1843 - } - }, - "context": { - "loc": { - "start": { - "line": 70, - "column": 0, - "index": 2030 - }, - "end": { - "line": 84, - "column": 2, - "index": 2493 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/conversion.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to parse" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Boolean" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "param", - "name": "radix", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the radix to convert to (default: 10)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "integer representation of value" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "int", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "int", - "kind": "function" - } - ], - "namespace": "int" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "int" - }, - { - "title": "param", - "description": "values to parse", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "ns" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "radix" - }, - { - "title": "return", - "description": "integer representation of values", - "lineNumber": 4, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "loc": { - "start": { - "line": 64, - "column": 0, - "index": 1844 - }, - "end": { - "line": 69, - "column": 3, - "index": 2029 - } - }, - "context": { - "loc": { - "start": { - "line": 70, - "column": 0, - "index": 2030 - }, - "end": { - "line": 84, - "column": 2, - "index": 2493 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/conversion.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "ns", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "values to parse" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "param", - "name": "radix", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "integer representation of values" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "int", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "int", - "kind": "function" - } - ], - "namespace": "int" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "str" - }, - { - "title": "param", - "description": "value to parse", - "lineNumber": 6, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Boolean" - }, - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "Array" - } - ] - }, - "name": "n" - }, - { - "title": "return", - "description": "string representation of value", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 8 - } - ], - "loc": { - "start": { - "line": 86, - "column": 0, - "index": 2495 - }, - "end": { - "line": 103, - "column": 3, - "index": 3100 - } - }, - "context": { - "loc": { - "start": { - "line": 104, - "column": 0, - "index": 3101 - }, - "end": { - "line": 110, - "column": 2, - "index": 3237 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/conversion.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to parse" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Boolean" - }, - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "Array" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "string representation of value" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "str", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "str", - "kind": "function" - } - ], - "namespace": "str" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "boolean" - }, - { - "title": "param", - "description": "value to parse", - "lineNumber": 9, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Boolean" - }, - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "Array" - } - ] - }, - "name": "n" - }, - { - "title": "return", - "description": "boolean representation of value", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 112, - "column": 0, - "index": 3239 - }, - "end": { - "line": 131, - "column": 3, - "index": 4036 - } - }, - "context": { - "loc": { - "start": { - "line": 132, - "column": 0, - "index": 4037 - }, - "end": { - "line": 142, - "column": 2, - "index": 4336 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/conversion.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to parse" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Boolean" - }, - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "Array" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "boolean representation of value" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "boolean", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "boolean", - "kind": "function" - } - ], - "namespace": "boolean" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 7, - "name": "byte" - }, - { - "title": "param", - "description": "value to parse", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Boolean" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "n" - }, - { - "title": "return", - "description": "byte representation of value", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 144, - "column": 0, - "index": 4338 - }, - "end": { - "line": 165, - "column": 3, - "index": 5167 - } - }, - "context": { - "loc": { - "start": { - "line": 171, - "column": 0, - "index": 5325 - }, - "end": { - "line": 178, - "column": 2, - "index": 5544 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/conversion.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to parse" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Boolean" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "byte representation of value" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "byte", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "byte", - "kind": "function" - } - ], - "namespace": "byte" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "byte" - }, - { - "title": "param", - "description": "values to parse", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "ns" - }, - { - "title": "return", - "description": "array of byte representation of values", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "loc": { - "start": { - "line": 166, - "column": 0, - "index": 5168 - }, - "end": { - "line": 170, - "column": 3, - "index": 5324 - } - }, - "context": { - "loc": { - "start": { - "line": 171, - "column": 0, - "index": 5325 - }, - "end": { - "line": 178, - "column": 2, - "index": 5544 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/conversion.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "ns", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "values to parse" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "array of byte representation of values" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "byte", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "byte", - "kind": "function" - } - ], - "namespace": "byte" - }, - { - "description": "", - "tags": [ - { - "title": "function", - "description": null, - "lineNumber": 1, - "name": "byte" - }, - { - "title": "param", - "description": "the value to scale\n\nconverts a floating-point number in the range 0-1 to a byte 0-255", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v" - } - ], - "loc": { - "start": { - "line": 265, - "column": 4, - "index": 8236 - }, - "end": { - "line": 270, - "column": 9, - "index": 8403 - } - }, - "context": { - "loc": { - "start": { - "line": 271, - "column": 4, - "index": 8408 - }, - "end": { - "line": 273, - "column": 5, - "index": 8469 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/text.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the value to scale" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "converts a floating-point number in the range 0-1 to a byte 0-255" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "byte", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "byte", - "kind": "function" - } - ], - "namespace": "byte" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 7, - "name": "char" - }, - { - "title": "param", - "description": "value to parse", - "lineNumber": 8, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "n" - }, - { - "title": "return", - "description": "string representation of value", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\nprint(char(65)); // \"A\"\nprint(char('65')); // \"A\"\nprint(char([65, 66, 67])); // [ \"A\", \"B\", \"C\" ]\nprint(join(char([65, 66, 67]), '')); // \"ABC\"\n
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 180, - "column": 0, - "index": 5546 - }, - "end": { - "line": 198, - "column": 3, - "index": 6257 - } - }, - "context": { - "loc": { - "start": { - "line": 204, - "column": 0, - "index": 6407 - }, - "end": { - "line": 212, - "column": 2, - "index": 6683 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/conversion.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nprint(char(65)); // \"A\"\nprint(char('65')); // \"A\"\nprint(char([65, 66, 67])); // [ \"A\", \"B\", \"C\" ]\nprint(join(char([65, 66, 67]), '')); // \"ABC\"\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to parse" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "String" - }, - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "string representation of value" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "char", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "char", - "kind": "function" - } - ], - "namespace": "char" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "char" - }, - { - "title": "param", - "description": "values to parse", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "ns" - }, - { - "title": "return", - "description": "array of string representation of values", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "loc": { - "start": { - "line": 199, - "column": 0, - "index": 6258 - }, - "end": { - "line": 203, - "column": 3, - "index": 6406 - } - }, - "context": { - "loc": { - "start": { - "line": 204, - "column": 0, - "index": 6407 - }, - "end": { - "line": 212, - "column": 2, - "index": 6683 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/conversion.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "ns", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "values to parse" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "array of string representation of values" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "char", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "char", - "kind": "function" - } - ], - "namespace": "char" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "unchar" - }, - { - "title": "param", - "description": "value to parse", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "n" - }, - { - "title": "return", - "description": "integer representation of value", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\nprint(unchar('A')); // 65\nprint(unchar(['A', 'B', 'C'])); // [ 65, 66, 67 ]\nprint(unchar(split('ABC', ''))); // [ 65, 66, 67 ]\n
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 214, - "column": 0, - "index": 6685 - }, - "end": { - "line": 229, - "column": 3, - "index": 7219 - } - }, - "context": { - "loc": { - "start": { - "line": 235, - "column": 0, - "index": 7349 - }, - "end": { - "line": 241, - "column": 2, - "index": 7542 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/conversion.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nprint(unchar('A')); // 65\nprint(unchar(['A', 'B', 'C'])); // [ 65, 66, 67 ]\nprint(unchar(split('ABC', ''))); // [ 65, 66, 67 ]\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to parse" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "integer representation of value" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "unchar", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "unchar", - "kind": "function" - } - ], - "namespace": "unchar" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "unchar" - }, - { - "title": "param", - "description": "values to parse", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "ns" - }, - { - "title": "return", - "description": "integer representation of values", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "loc": { - "start": { - "line": 230, - "column": 0, - "index": 7220 - }, - "end": { - "line": 234, - "column": 3, - "index": 7348 - } - }, - "context": { - "loc": { - "start": { - "line": 235, - "column": 0, - "index": 7349 - }, - "end": { - "line": 241, - "column": 2, - "index": 7542 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/conversion.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "ns", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "values to parse" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "integer representation of values" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "unchar", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "unchar", - "kind": "function" - } - ], - "namespace": "unchar" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "hex" - }, - { - "title": "param", - "description": "value to parse", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "n" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "digits" - }, - { - "title": "return", - "description": "hexadecimal string representation of value", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 243, - "column": 0, - "index": 7544 - }, - "end": { - "line": 262, - "column": 3, - "index": 8279 - } - }, - "context": { - "loc": { - "start": { - "line": 269, - "column": 0, - "index": 8454 - }, - "end": { - "line": 291, - "column": 2, - "index": 9112 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/conversion.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to parse" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "digits", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "hexadecimal string representation of value" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "hex", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "hex", - "kind": "function" - } - ], - "namespace": "hex" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "hex" - }, - { - "title": "param", - "description": "array of values to parse", - "lineNumber": 2, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "ns" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "digits" - }, - { - "title": "return", - "description": "hexadecimal string representation of values", - "lineNumber": 4, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "loc": { - "start": { - "line": 263, - "column": 0, - "index": 8280 - }, - "end": { - "line": 268, - "column": 3, - "index": 8453 - } - }, - "context": { - "loc": { - "start": { - "line": 269, - "column": 0, - "index": 8454 - }, - "end": { - "line": 291, - "column": 2, - "index": 9112 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/conversion.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "ns", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "array of values to parse" - } - ] - } - ] - }, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "param", - "name": "digits", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "hexadecimal string representation of values" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "hex", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "hex", - "kind": "function" - } - ], - "namespace": "hex" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "unhex" - }, - { - "title": "param", - "description": "value to parse", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "n" - }, - { - "title": "return", - "description": "integer representation of hexadecimal value", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\nprint(unhex('A')); // 10\nprint(unhex('FF')); // 255\nprint(unhex(['FF', 'AA', '00'])); // [ 255, 170, 0 ]\n
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 293, - "column": 0, - "index": 9114 - }, - "end": { - "line": 308, - "column": 3, - "index": 9639 - } - }, - "context": { - "loc": { - "start": { - "line": 314, - "column": 0, - "index": 9774 - }, - "end": { - "line": 320, - "column": 2, - "index": 9927 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/conversion.js" - }, - "augments": [], - "examples": [ - { - "description": "
\nprint(unhex('A')); // 10\nprint(unhex('FF')); // 255\nprint(unhex(['FF', 'AA', '00'])); // [ 255, 170, 0 ]\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "n", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "value to parse" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "integer representation of hexadecimal value" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "unhex", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "unhex", - "kind": "function" - } - ], - "namespace": "unhex" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "unhex" - }, - { - "title": "param", - "description": "values to parse", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "ns" - }, - { - "title": "return", - "description": "integer representations of hexadecimal value", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "loc": { - "start": { - "line": 309, - "column": 0, - "index": 9640 - }, - "end": { - "line": 313, - "column": 3, - "index": 9773 - } - }, - "context": { - "loc": { - "start": { - "line": 314, - "column": 0, - "index": 9774 - }, - "end": { - "line": 320, - "column": 2, - "index": 9927 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/conversion.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "ns", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "values to parse" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "integer representations of hexadecimal value" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "unhex", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "unhex", - "kind": "function" - } - ], - "namespace": "unhex" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "nf()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " or\nnfs()." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "join" - }, - { - "title": "param", - "description": "array of Strings to be joined", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "list" - }, - { - "title": "param", - "description": "String to be placed between each item", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "separator" - }, - { - "title": "return", - "description": "joined String", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - } - ], - "loc": { - "start": { - "line": 13, - "column": 0, - "index": 256 - }, - "end": { - "line": 33, - "column": 3, - "index": 948 - } - }, - "context": { - "loc": { - "start": { - "line": 34, - "column": 0, - "index": 949 - }, - "end": { - "line": 37, - "column": 2, - "index": 1075 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/string_functions.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "list", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "array of Strings to be joined" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "param", - "name": "separator", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "String to be placed between each item" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "joined String" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "join", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "join", - "kind": "function" - } - ], - "namespace": "join" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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)." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 18, - "name": "match" - }, - { - "title": "param", - "description": "the String to be searched", - "lineNumber": 19, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "str" - }, - { - "title": "param", - "description": "the regexp to be used for matching", - "lineNumber": 20, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "regexp" - }, - { - "title": "return", - "description": "Array of Strings found", - "lineNumber": 21, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 39, - "column": 0, - "index": 1077 - }, - "end": { - "line": 71, - "column": 3, - "index": 2412 - } - }, - "context": { - "loc": { - "start": { - "line": 72, - "column": 0, - "index": 2413 - }, - "end": { - "line": 75, - "column": 2, - "index": 2528 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/string_functions.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "str", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the String to be searched" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "regexp", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the regexp to be used for matching" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of Strings found" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "match", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "match", - "kind": "function" - } - ], - "namespace": "match" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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)." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 19, - "name": "matchAll" - }, - { - "title": "param", - "description": "the String to be searched", - "lineNumber": 20, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "str" - }, - { - "title": "param", - "description": "the regexp to be used for matching", - "lineNumber": 21, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "regexp" - }, - { - "title": "return", - "description": "2d Array of Strings found", - "lineNumber": 22, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "example", - "description": "
\n\nlet string = 'Hello p5js*! Hello world!';\nlet regexp = 'Hello';\nmatchAll(string, regexp);\n\n
", - "lineNumber": 23 - } - ], - "loc": { - "start": { - "line": 77, - "column": 0, - "index": 2530 - }, - "end": { - "line": 108, - "column": 3, - "index": 3899 - } - }, - "context": { - "loc": { - "start": { - "line": 109, - "column": 0, - "index": 3900 - }, - "end": { - "line": 122, - "column": 2, - "index": 4278 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/string_functions.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nlet string = 'Hello p5js*! Hello world!';\nlet regexp = 'Hello';\nmatchAll(string, regexp);\n\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "str", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the String to be searched" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "regexp", - "lineNumber": 21, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the regexp to be used for matching" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "2d Array of Strings found" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "matchAll", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "matchAll", - "kind": "function" - } - ], - "namespace": "matchAll" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Utility function for formatting numbers into strings. There are two\nversions: one for formatting floats, and one for formatting ints." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The values for the digits, left, and right parameters should always\nbe positive integers." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "(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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 14, - "name": "nf" - }, - { - "title": "param", - "description": "the Number to format", - "lineNumber": 15, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "num" - }, - { - "title": "param", - "description": "number of digits to the left of the\n decimal point", - "lineNumber": 16, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - "name": "left" - }, - { - "title": "param", - "description": "number of digits to the right of the\n decimal point", - "lineNumber": 18, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - "name": "right" - }, - { - "title": "return", - "description": "formatted String", - "lineNumber": 20, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 22 - } - ], - "loc": { - "start": { - "line": 124, - "column": 0, - "index": 4280 - }, - "end": { - "line": 168, - "column": 3, - "index": 5734 - } - }, - "context": { - "loc": { - "start": { - "line": 176, - "column": 0, - "index": 5947 - }, - "end": { - "line": 194, - "column": 2, - "index": 6519 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/string_functions.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "num", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the Number to format" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "param", - "name": "left", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of digits to the left of the\ndecimal point" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - }, - { - "title": "param", - "name": "right", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of digits to the right of the\ndecimal point" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "formatted String" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "nf", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "nf", - "kind": "function" - } - ], - "namespace": "nf" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "nf" - }, - { - "title": "param", - "description": "the Numbers to format", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "nums" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - "name": "left" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - "name": "right" - }, - { - "title": "return", - "description": "formatted Strings", - "lineNumber": 5, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "loc": { - "start": { - "line": 169, - "column": 0, - "index": 5735 - }, - "end": { - "line": 175, - "column": 3, - "index": 5946 - } - }, - "context": { - "loc": { - "start": { - "line": 176, - "column": 0, - "index": 5947 - }, - "end": { - "line": 194, - "column": 2, - "index": 6519 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/string_functions.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "nums", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the Numbers to format" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "param", - "name": "left", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - }, - { - "title": "param", - "name": "right", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "formatted Strings" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "nf", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "nf", - "kind": "function" - } - ], - "namespace": "nf" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "nfc" - }, - { - "title": "param", - "description": "the Number to format", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "num" - }, - { - "title": "param", - "description": "number of digits to the right of the\n decimal point", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - "name": "right" - }, - { - "title": "return", - "description": "formatted String", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - } - ], - "loc": { - "start": { - "line": 214, - "column": 0, - "index": 7047 - }, - "end": { - "line": 250, - "column": 3, - "index": 8065 - } - }, - "context": { - "loc": { - "start": { - "line": 257, - "column": 0, - "index": 8229 - }, - "end": { - "line": 264, - "column": 2, - "index": 8434 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/string_functions.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "num", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the Number to format" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Number" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "param", - "name": "right", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of digits to the right of the\ndecimal point" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "formatted String" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "nfc", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "nfc", - "kind": "function" - } - ], - "namespace": "nfc" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "nfc" - }, - { - "title": "param", - "description": "the Numbers to format", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "nums" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - "name": "right" - }, - { - "title": "return", - "description": "formatted Strings", - "lineNumber": 4, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "loc": { - "start": { - "line": 251, - "column": 0, - "index": 8066 - }, - "end": { - "line": 256, - "column": 3, - "index": 8228 - } - }, - "context": { - "loc": { - "start": { - "line": 257, - "column": 0, - "index": 8229 - }, - "end": { - "line": 264, - "column": 2, - "index": 8434 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/string_functions.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "nums", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the Numbers to format" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "param", - "name": "right", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "Integer" - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "formatted Strings" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "nfc", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "nfc", - "kind": "function" - } - ], - "namespace": "nfc" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Utility function for formatting numbers into strings. Similar to " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "nf()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 7, - "name": "nfp" - }, - { - "title": "param", - "description": "the Number to format", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "num" - }, - { - "title": "param", - "description": "number of digits to the left of the decimal\n point", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "left" - }, - { - "title": "param", - "description": "number of digits to the right of the\n decimal point", - "lineNumber": 11, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "right" - }, - { - "title": "return", - "description": "formatted String", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 15 - } - ], - "loc": { - "start": { - "line": 287, - "column": 0, - "index": 9019 - }, - "end": { - "line": 326, - "column": 3, - "index": 10215 - } - }, - "context": { - "loc": { - "start": { - "line": 334, - "column": 0, - "index": 10405 - }, - "end": { - "line": 342, - "column": 2, - "index": 10639 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/string_functions.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "num", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the Number to format" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "left", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of digits to the left of the decimal\npoint" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - }, - { - "title": "param", - "name": "right", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of digits to the right of the\ndecimal point" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "formatted String" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "nfp", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "nfp", - "kind": "function" - } - ], - "namespace": "nfp" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "nfp" - }, - { - "title": "param", - "description": "the Numbers to format", - "lineNumber": 2, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "nums" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "left" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "right" - }, - { - "title": "return", - "description": "formatted Strings", - "lineNumber": 5, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "loc": { - "start": { - "line": 327, - "column": 0, - "index": 10216 - }, - "end": { - "line": 333, - "column": 3, - "index": 10404 - } - }, - "context": { - "loc": { - "start": { - "line": 334, - "column": 0, - "index": 10405 - }, - "end": { - "line": 342, - "column": 2, - "index": 10639 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/string_functions.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "nums", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the Numbers to format" - } - ] - } - ] - }, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "param", - "name": "left", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - }, - { - "title": "param", - "name": "right", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "formatted Strings" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "nfp", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "nfp", - "kind": "function" - } - ], - "namespace": "nfp" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Utility function for formatting numbers into strings. Similar to " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "nf()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " but\nputs an additional \"_\" (space) in front of positive numbers just in case to align it with negative\nnumbers which includes \"-\" (minus) sign." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The values for the digits, left, and right parameters should always be positive integers." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "(IMP): The result on the canvas basically the expected alignment can vary based on the typeface you are using." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "(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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 20, - "name": "nfs" - }, - { - "title": "param", - "description": "the Number to format", - "lineNumber": 21, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "num" - }, - { - "title": "param", - "description": "number of digits to the left of the decimal\n point", - "lineNumber": 22, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "left" - }, - { - "title": "param", - "description": "number of digits to the right of the\n decimal point", - "lineNumber": 24, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "right" - }, - { - "title": "return", - "description": "formatted String", - "lineNumber": 26, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 28 - } - ], - "loc": { - "start": { - "line": 348, - "column": 0, - "index": 10737 - }, - "end": { - "line": 403, - "column": 3, - "index": 13014 - } - }, - "context": { - "loc": { - "start": { - "line": 411, - "column": 0, - "index": 13207 - }, - "end": { - "line": 419, - "column": 2, - "index": 13441 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/string_functions.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "num", - "lineNumber": 21, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the Number to format" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "left", - "lineNumber": 22, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of digits to the left of the decimal\npoint" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - }, - { - "title": "param", - "name": "right", - "lineNumber": 24, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of digits to the right of the\ndecimal point" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "formatted String" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "nfs", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "nfs", - "kind": "function" - } - ], - "namespace": "nfs" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "nfs" - }, - { - "title": "param", - "description": "the Numbers to format", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "nums" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "left" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "right" - }, - { - "title": "return", - "description": "formatted Strings", - "lineNumber": 5, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "loc": { - "start": { - "line": 404, - "column": 0, - "index": 13015 - }, - "end": { - "line": 410, - "column": 3, - "index": 13206 - } - }, - "context": { - "loc": { - "start": { - "line": 411, - "column": 0, - "index": 13207 - }, - "end": { - "line": 419, - "column": 2, - "index": 13441 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/string_functions.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "nums", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the Numbers to format" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - }, - { - "title": "param", - "name": "left", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - }, - { - "title": "param", - "name": "right", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "formatted Strings" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "nfs", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "nfs", - "kind": "function" - } - ], - "namespace": "nfs" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "split()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "splitTokens()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function works in a similar fashion, except that it\nsplits using a range of characters instead of a specific character or\nsequence." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 10, - "name": "split" - }, - { - "title": "param", - "description": "the String to be split", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "the String used to separate the data", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "delim" - }, - { - "title": "return", - "description": "Array of Strings", - "lineNumber": 13, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 425, - "column": 0, - "index": 13540 - }, - "end": { - "line": 450, - "column": 3, - "index": 14537 - } - }, - "context": { - "loc": { - "start": { - "line": 451, - "column": 0, - "index": 14538 - }, - "end": { - "line": 454, - "column": 2, - "index": 14657 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/string_functions.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the String to be split" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "delim", - "lineNumber": 12, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the String used to separate the data" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of Strings" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "split", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "split", - "kind": "function" - } - ], - "namespace": "split" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "splitTokens()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "splitTokens" - }, - { - "title": "param", - "description": "the String to be split", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "param", - "description": "list of individual Strings that will be used as\n separators", - "lineNumber": 11, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "delim" - }, - { - "title": "return", - "description": "Array of Strings", - "lineNumber": 13, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 14 - } - ], - "loc": { - "start": { - "line": 456, - "column": 0, - "index": 14659 - }, - "end": { - "line": 481, - "column": 3, - "index": 15568 - } - }, - "context": { - "loc": { - "start": { - "line": 482, - "column": 0, - "index": 15569 - }, - "end": { - "line": 507, - "column": 2, - "index": 16418 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/string_functions.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the String to be split" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "delim", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "list of individual Strings that will be used as\nseparators" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Array of Strings" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "splitTokens", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "splitTokens", - "kind": "function" - } - ], - "namespace": "splitTokens" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "trim" - }, - { - "title": "param", - "description": "a String to be trimmed", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "str" - }, - { - "title": "return", - "description": "a trimmed String", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "example", - "description": "
\n\nlet string = trim(' No new lines\\n ');\ntext(string + ' here', 2, 50);\ndescribe('“No new lines here” displayed center canvas');\n\n
", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 509, - "column": 0, - "index": 16420 - }, - "end": { - "line": 526, - "column": 3, - "index": 16953 - } - }, - "context": { - "loc": { - "start": { - "line": 532, - "column": 0, - "index": 17088 - }, - "end": { - "line": 539, - "column": 2, - "index": 17270 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/string_functions.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nlet string = trim(' No new lines\\n ');\ntext(string + ' here', 2, 50);\ndescribe('“No new lines here” displayed center canvas');\n\n
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "str", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a String to be trimmed" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a trimmed String" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "trim", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "trim", - "kind": "function" - } - ], - "namespace": "trim" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "trim" - }, - { - "title": "param", - "description": "an Array of Strings to be trimmed", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Array" - }, - "name": "strs" - }, - { - "title": "return", - "description": "an Array of trimmed Strings", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "loc": { - "start": { - "line": 527, - "column": 0, - "index": 16954 - }, - "end": { - "line": 531, - "column": 3, - "index": 17087 - } - }, - "context": { - "loc": { - "start": { - "line": 532, - "column": 0, - "index": 17088 - }, - "end": { - "line": 539, - "column": 2, - "index": 17270 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/string_functions.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "strs", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "an Array of Strings to be trimmed" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Array" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "an Array of trimmed Strings" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "trim", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "trim", - "kind": "function" - } - ], - "namespace": "trim" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "p5.js communicates with the clock on your computer. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "day()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function\nreturns the current day as a value from 1 - 31." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "day" - }, - { - "title": "return", - "description": "the current day", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\n\nlet d = day();\ntext('Current day: \\n' + d, 5, 50);\ndescribe('Current day is displayed');\n\n
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 110 - }, - "end": { - "line": 24, - "column": 3, - "index": 470 - } - }, - "context": { - "loc": { - "start": { - "line": 25, - "column": 0, - "index": 471 - }, - "end": { - "line": 27, - "column": 2, - "index": 536 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/time_date.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nlet d = day();\ntext('Current day: \\n' + d, 5, 50);\ndescribe('Current day is displayed');\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the current day" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "day", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "day", - "kind": "function" - } - ], - "namespace": "day" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "p5.js communicates with the clock on your computer. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "hour()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function\nreturns the current hour as a value from 0 - 23." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "hour" - }, - { - "title": "return", - "description": "the current hour", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\n\nlet h = hour();\ntext('Current hour:\\n' + h, 5, 50);\ndescribe('Current hour is displayed');\n\n
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 29, - "column": 0, - "index": 538 - }, - "end": { - "line": 43, - "column": 3, - "index": 905 - } - }, - "context": { - "loc": { - "start": { - "line": 44, - "column": 0, - "index": 906 - }, - "end": { - "line": 46, - "column": 2, - "index": 973 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/time_date.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nlet h = hour();\ntext('Current hour:\\n' + h, 5, 50);\ndescribe('Current hour is displayed');\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the current hour" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "hour", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "hour", - "kind": "function" - } - ], - "namespace": "hour" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "p5.js communicates with the clock on your computer. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "minute()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function\nreturns the current minute as a value from 0 - 59." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "minute" - }, - { - "title": "return", - "description": "the current minute", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\n\nlet m = minute();\ntext('Current minute: \\n' + m, 5, 50);\ndescribe('Current minute is displayed');\n\n
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 48, - "column": 0, - "index": 975 - }, - "end": { - "line": 62, - "column": 3, - "index": 1359 - } - }, - "context": { - "loc": { - "start": { - "line": 63, - "column": 0, - "index": 1360 - }, - "end": { - "line": 65, - "column": 2, - "index": 1431 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/time_date.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nlet m = minute();\ntext('Current minute: \\n' + m, 5, 50);\ndescribe('Current minute is displayed');\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the current minute" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "minute", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "minute", - "kind": "function" - } - ], - "namespace": "minute" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Returns the number of milliseconds (thousandths of a second) since\nstarting the sketch (when " - }, - { - "type": "inlineCode", - "value": "setup()" - }, - { - "type": "text", - "value": " is called). This information is often\nused for timing events and animation sequences." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "millis" - }, - { - "title": "return", - "description": "the number of milliseconds since starting the sketch", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "example", - "description": "
\n\nlet millisecond = millis();\ntext('Milliseconds \\nrunning: \\n' + millisecond, 5, 40);\ndescribe('number of milliseconds since sketch has started displayed');\n\n
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 67, - "column": 0, - "index": 1433 - }, - "end": { - "line": 82, - "column": 3, - "index": 1949 - } - }, - "context": { - "loc": { - "start": { - "line": 83, - "column": 0, - "index": 1950 - }, - "end": { - "line": 90, - "column": 2, - "index": 2137 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/time_date.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nlet millisecond = millis();\ntext('Milliseconds \\nrunning: \\n' + millisecond, 5, 40);\ndescribe('number of milliseconds since sketch has started displayed');\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the number of milliseconds since starting the sketch" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "millis", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "millis", - "kind": "function" - } - ], - "namespace": "millis" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "p5.js communicates with the clock on your computer. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "month()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function\nreturns the current month as a value from 1 - 12." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "month" - }, - { - "title": "return", - "description": "the current month", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\n\nlet m = month();\ntext('Current month: \\n' + m, 5, 50);\ndescribe('Current month is displayed');\n\n
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 92, - "column": 0, - "index": 2139 - }, - "end": { - "line": 106, - "column": 3, - "index": 2515 - } - }, - "context": { - "loc": { - "start": { - "line": 107, - "column": 0, - "index": 2516 - }, - "end": { - "line": 110, - "column": 2, - "index": 2606 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/time_date.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nlet m = month();\ntext('Current month: \\n' + m, 5, 50);\ndescribe('Current month is displayed');\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the current month" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "month", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "month", - "kind": "function" - } - ], - "namespace": "month" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "p5.js communicates with the clock on your computer. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "second()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function\nreturns the current second as a value from 0 - 59." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "second" - }, - { - "title": "return", - "description": "the current second", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\n\nlet s = second();\ntext('Current second: \\n' + s, 5, 50);\ndescribe('Current second is displayed');\n\n
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 112, - "column": 0, - "index": 2608 - }, - "end": { - "line": 126, - "column": 3, - "index": 2992 - } - }, - "context": { - "loc": { - "start": { - "line": 127, - "column": 0, - "index": 2993 - }, - "end": { - "line": 129, - "column": 2, - "index": 3064 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/time_date.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nlet s = second();\ntext('Current second: \\n' + s, 5, 50);\ndescribe('Current second is displayed');\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the current second" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "second", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "second", - "kind": "function" - } - ], - "namespace": "second" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "p5.js communicates with the clock on your computer. The " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "year()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function\nreturns the current year as an integer (2014, 2015, 2016, etc)." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "year" - }, - { - "title": "return", - "description": "the current year", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Integer" - } - }, - { - "title": "example", - "description": "
\n\nlet y = year();\ntext('Current year: \\n' + y, 5, 50);\ndescribe('Current year is displayed');\n\n
", - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 131, - "column": 0, - "index": 3066 - }, - "end": { - "line": 145, - "column": 3, - "index": 3449 - } - }, - "context": { - "loc": { - "start": { - "line": 146, - "column": 0, - "index": 3450 - }, - "end": { - "line": 148, - "column": 2, - "index": 3520 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/utilities/time_date.js" - }, - "augments": [], - "examples": [ - { - "description": "
\n\nlet y = year();\ntext('Current year: \\n' + y, 5, 50);\ndescribe('Current year is displayed');\n\n
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the current year" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Integer" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "year", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "year", - "kind": "function" - } - ], - "namespace": "year" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Starts creating a new p5.Geometry. Subsequent shapes drawn will be added\nto the geometry and then returned when\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endGeometry()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is called. One can also use\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "buildGeometry()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to pass a function that\ndraws shapes." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If you need to draw complex shapes every frame which don't change over time,\ncombining them upfront with " - }, - { - "type": "inlineCode", - "value": "beginGeometry()" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "endGeometry()" - }, - { - "type": "text", - "value": " and then\ndrawing that will run faster than repeatedly drawing the individual pieces." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 11, - "name": "beginGeometry" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - }, - { - "title": "alt", - "description": "A series of different flat, curved, and 3D shapes floating in space.", - "lineNumber": 69 - } - ], - "loc": { - "start": { - "line": 13, - "column": 0, - "index": 212 - }, - "end": { - "line": 84, - "column": 3, - "index": 1747 - } - }, - "context": { - "loc": { - "start": { - "line": 85, - "column": 0, - "index": 1748 - }, - "end": { - "line": 87, - "column": 2, - "index": 1833 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/3d_primitives.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "beginGeometry", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "beginGeometry", - "kind": "function" - } - ], - "namespace": "beginGeometry" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Finishes creating a new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Geometry" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " that was\nstarted using " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginGeometry()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". One can also\nuse " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "buildGeometry()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to pass a function that\ndraws shapes." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "endGeometry" - }, - { - "title": "returns", - "description": "The model that was built.", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - } - } - ], - "loc": { - "start": { - "line": 89, - "column": 0, - "index": 1835 - }, - "end": { - "line": 97, - "column": 3, - "index": 2173 - } - }, - "context": { - "loc": { - "start": { - "line": 98, - "column": 0, - "index": 2174 - }, - "end": { - "line": 100, - "column": 2, - "index": 2255 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/3d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The model that was built." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "endGeometry", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "endGeometry", - "kind": "function" - } - ], - "namespace": "endGeometry" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Geometry" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " that contains all\nthe shapes drawn in a provided callback function. The returned combined shape\ncan then be drawn all at once using " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "model()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If you need to draw complex shapes every frame which don't change over time,\ncombining them with " - }, - { - "type": "inlineCode", - "value": "buildGeometry()" - }, - { - "type": "text", - "value": " once and then drawing that will run\nfaster than repeatedly drawing the individual pieces." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "One can also draw shapes directly between\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginGeometry()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "endGeometry()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " instead of using a callback\nfunction." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 14, - "name": "buildGeometry" - }, - { - "title": "param", - "description": "A function that draws shapes.", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Function" - }, - "name": "callback" - }, - { - "title": "returns", - "description": "The model that was built from the callback function.", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 18 - }, - { - "title": "alt", - "description": "A cluster of spheres.", - "lineNumber": 58 - } - ], - "loc": { - "start": { - "line": 102, - "column": 0, - "index": 2257 - }, - "end": { - "line": 162, - "column": 3, - "index": 3852 - } - }, - "context": { - "loc": { - "start": { - "line": 163, - "column": 0, - "index": 3853 - }, - "end": { - "line": 165, - "column": 2, - "index": 3954 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/3d_primitives.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "callback", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A function that draws shapes." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Function" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The model that was built from the callback function." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "buildGeometry", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "buildGeometry", - "kind": "function" - } - ], - "namespace": "buildGeometry" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This method works on models generated with\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "buildGeometry()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " as well as those loaded\nfrom " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadModel()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "freeGeometry" - }, - { - "title": "param", - "description": "The geometry whose resources should be freed", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - }, - "name": "geometry" - } - ], - "loc": { - "start": { - "line": 167, - "column": 0, - "index": 3956 - }, - "end": { - "line": 178, - "column": 3, - "index": 4433 - } - }, - "context": { - "loc": { - "start": { - "line": 179, - "column": 0, - "index": 4434 - }, - "end": { - "line": 181, - "column": 2, - "index": 4530 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/3d_primitives.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "geometry", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The geometry whose resources should be freed" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "freeGeometry", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "freeGeometry", - "kind": "function" - } - ], - "namespace": "freeGeometry" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Draw a plane with given a width and height" - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 2, - "name": "plane" - }, - { - "title": "param", - "description": "width of the plane", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "width" - }, - { - "title": "param", - "description": "height of the plane", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "height" - }, - { - "title": "param", - "description": "Optional number of triangle\n subdivisions in x-dimension", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailX" - }, - { - "title": "param", - "description": "Optional number of triangle\n subdivisions in y-dimension", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailY" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 9 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 27 - } - ], - "loc": { - "start": { - "line": 183, - "column": 0, - "index": 4532 - }, - "end": { - "line": 218, - "column": 3, - "index": 5616 - } - }, - "context": { - "loc": { - "start": { - "line": 219, - "column": 0, - "index": 5617 - }, - "end": { - "line": 266, - "column": 2, - "index": 6957 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/3d_primitives.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "width", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "width of the plane" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "height", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "height of the plane" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "detailX", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Optional number of triangle\nsubdivisions in x-dimension" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - }, - { - "title": "param", - "name": "detailY", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Optional number of triangle\nsubdivisions in y-dimension" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "plane", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "plane", - "kind": "function" - } - ], - "namespace": "plane" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Draw a box with given width, height and depth" - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 2, - "name": "box" - }, - { - "title": "param", - "description": "width of the box", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "width" - }, - { - "title": "param", - "description": "height of the box", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "height" - }, - { - "title": "param", - "description": "depth of the box", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "depth" - }, - { - "title": "param", - "description": "Optional number of triangle\n subdivisions in x-dimension", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailX" - }, - { - "title": "param", - "description": "Optional number of triangle\n subdivisions in y-dimension", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailY" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 10 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 11 - } - ], - "loc": { - "start": { - "line": 268, - "column": 0, - "index": 6959 - }, - "end": { - "line": 299, - "column": 3, - "index": 7891 - } - }, - "context": { - "loc": { - "start": { - "line": 300, - "column": 0, - "index": 7892 - }, - "end": { - "line": 387, - "column": 2, - "index": 10430 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/3d_primitives.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "width", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "width of the box" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "height", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "height of the box" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "depth", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "depth of the box" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "detailX", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Optional number of triangle\nsubdivisions in x-dimension" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - }, - { - "title": "param", - "name": "detailY", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Optional number of triangle\nsubdivisions in y-dimension" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "box", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "box", - "kind": "function" - } - ], - "namespace": "box" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Draw a sphere with given radius." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 7, - "name": "sphere" - }, - { - "title": "param", - "description": "radius of circle", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "radius" - }, - { - "title": "param", - "description": "optional number of subdivisions in x-dimension", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailX" - }, - { - "title": "param", - "description": "optional number of subdivisions in y-dimension", - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailY" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 12 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 29 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 52 - } - ], - "loc": { - "start": { - "line": 389, - "column": 0, - "index": 10432 - }, - "end": { - "line": 463, - "column": 3, - "index": 12376 - } - }, - "context": { - "loc": { - "start": { - "line": 464, - "column": 0, - "index": 12377 - }, - "end": { - "line": 480, - "column": 2, - "index": 12774 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/3d_primitives.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - }, - { - "description": "
\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
" - }, - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "radius", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "radius of circle" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "detailX", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional number of subdivisions in x-dimension" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - }, - { - "title": "param", - "name": "detailY", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "optional number of subdivisions in y-dimension" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "sphere", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "sphere", - "kind": "function" - } - ], - "namespace": "sphere" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Draw a cylinder with given radius and height" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "cylinder" - }, - { - "title": "param", - "description": "radius of the surface", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "radius" - }, - { - "title": "param", - "description": "height of the cylinder", - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "height" - }, - { - "title": "param", - "description": "number of subdivisions in x-dimension;\n default is 24", - "lineNumber": 11, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailX" - }, - { - "title": "param", - "description": "number of subdivisions in y-dimension;\n default is 1", - "lineNumber": 13, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailY" - }, - { - "title": "param", - "description": "whether to draw the bottom of the cylinder", - "lineNumber": 15, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - }, - "name": "bottomCap" - }, - { - "title": "param", - "description": "whether to draw the top of the cylinder", - "lineNumber": 16, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - }, - "name": "topCap" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 17 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 18 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 37 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 60 - } - ], - "loc": { - "start": { - "line": 600, - "column": 0, - "index": 15974 - }, - "end": { - "line": 682, - "column": 3, - "index": 18313 - } - }, - "context": { - "loc": { - "start": { - "line": 683, - "column": 0, - "index": 18314 - }, - "end": { - "line": 740, - "column": 2, - "index": 19666 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/3d_primitives.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - }, - { - "description": "
\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
" - }, - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "radius", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "radius of the surface" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "height", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "height of the cylinder" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "detailX", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of subdivisions in x-dimension;\ndefault is 24" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - }, - { - "title": "param", - "name": "detailY", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of subdivisions in y-dimension;\ndefault is 1" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - }, - { - "title": "param", - "name": "bottomCap", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "whether to draw the bottom of the cylinder" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - } - }, - { - "title": "param", - "name": "topCap", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "whether to draw the top of the cylinder" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "cylinder", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "cylinder", - "kind": "function" - } - ], - "namespace": "cylinder" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Draw a cone with given radius and height" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 7, - "name": "cone" - }, - { - "title": "param", - "description": "radius of the bottom surface", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "radius" - }, - { - "title": "param", - "description": "height of the cone", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "height" - }, - { - "title": "param", - "description": "number of segments,\n the more segments the smoother geometry\n default is 24", - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailX" - }, - { - "title": "param", - "description": "number of segments,\n the more segments the smoother geometry\n default is 1", - "lineNumber": 13, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailY" - }, - { - "title": "param", - "description": "whether to draw the base of the cone", - "lineNumber": 16, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - }, - "name": "cap" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 17 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 18 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 37 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 60 - } - ], - "loc": { - "start": { - "line": 742, - "column": 0, - "index": 19668 - }, - "end": { - "line": 824, - "column": 3, - "index": 21965 - } - }, - "context": { - "loc": { - "start": { - "line": 825, - "column": 0, - "index": 21966 - }, - "end": { - "line": 862, - "column": 2, - "index": 23049 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/3d_primitives.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - }, - { - "description": "
\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
" - }, - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "radius", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "radius of the bottom surface" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "height", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "height of the cone" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "detailX", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of segments,\nthe more segments the smoother geometry\ndefault is 24" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - }, - { - "title": "param", - "name": "detailY", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of segments,\nthe more segments the smoother geometry\ndefault is 1" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - }, - { - "title": "param", - "name": "cap", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "whether to draw the base of the cone" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Boolean" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "cone", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "cone", - "kind": "function" - } - ], - "namespace": "cone" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Draw an ellipsoid with given radius" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "ellipsoid" - }, - { - "title": "param", - "description": "x-radius of ellipsoid", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "radiusx" - }, - { - "title": "param", - "description": "y-radius of ellipsoid", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "radiusy" - }, - { - "title": "param", - "description": "z-radius of ellipsoid", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "radiusz" - }, - { - "title": "param", - "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.", - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailX" - }, - { - "title": "param", - "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.", - "lineNumber": 14, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailY" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 18 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 19 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 36 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 59 - } - ], - "loc": { - "start": { - "line": 864, - "column": 0, - "index": 23051 - }, - "end": { - "line": 945, - "column": 3, - "index": 25500 - } - }, - "context": { - "loc": { - "start": { - "line": 946, - "column": 0, - "index": 25501 - }, - "end": { - "line": 1004, - "column": 2, - "index": 27279 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/3d_primitives.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - }, - { - "description": "
\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
" - }, - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "radiusx", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x-radius of ellipsoid" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "radiusy", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y-radius of ellipsoid" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "radiusz", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z-radius of ellipsoid" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "detailX", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of segments,\nthe more segments the smoother geometry\ndefault is 24. Avoid detail number above\n150, it may crash the browser." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - }, - { - "title": "param", - "name": "detailY", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of segments,\nthe more segments the smoother geometry\ndefault is 16. Avoid detail number above\n150, it may crash the browser." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "ellipsoid", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ellipsoid", - "kind": "function" - } - ], - "namespace": "ellipsoid" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Draw a torus with given radius and tube radius" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "torus" - }, - { - "title": "param", - "description": "radius of the whole ring", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "radius" - }, - { - "title": "param", - "description": "radius of the tube", - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "tubeRadius" - }, - { - "title": "param", - "description": "number of segments in x-dimension,\n the more segments the smoother geometry\n default is 24", - "lineNumber": 11, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailX" - }, - { - "title": "param", - "description": "number of segments in y-dimension,\n the more segments the smoother geometry\n default is 16", - "lineNumber": 14, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailY" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 17 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 18 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 39 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 64 - } - ], - "loc": { - "start": { - "line": 1006, - "column": 0, - "index": 27281 - }, - "end": { - "line": 1094, - "column": 3, - "index": 29971 - } - }, - "context": { - "loc": { - "start": { - "line": 1095, - "column": 0, - "index": 29972 - }, - "end": { - "line": 1164, - "column": 2, - "index": 31986 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/3d_primitives.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - }, - { - "description": "
\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
" - }, - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "radius", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "radius of the whole ring" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "tubeRadius", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "radius of the tube" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "detailX", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of segments in x-dimension,\nthe more segments the smoother geometry\ndefault is 24" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - }, - { - "title": "param", - "name": "detailY", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of segments in y-dimension,\nthe more segments the smoother geometry\ndefault is 16" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "torus", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "torus", - "kind": "function" - } - ], - "namespace": "torus" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "3D" - }, - { - "title": "submodule", - "description": "Interaction", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 76 - } - }, - "context": { - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 78 - }, - "end": { - "line": 8, - "column": 30, - "index": 108 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/interaction.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "3D", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "3D", - "kind": "module" - } - ], - "namespace": "3D" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "3D" - }, - { - "title": "submodule", - "description": "Lights", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 71 - } - }, - "context": { - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 73 - }, - "end": { - "line": 8, - "column": 30, - "index": 103 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "3D", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "3D", - "kind": "module" - } - ], - "namespace": "3D" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "3D" - }, - { - "title": "submodule", - "description": "Material", - "lineNumber": 2 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 3 - }, - { - "title": "requires", - "description": null, - "lineNumber": 4, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 6, - "column": 3, - "index": 73 - } - }, - "context": { - "loc": { - "start": { - "line": 8, - "column": 0, - "index": 75 - }, - "end": { - "line": 8, - "column": 30, - "index": 105 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/material.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "3D", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "3D", - "kind": "module" - } - ], - "namespace": "3D" - }, - { - "description": "", - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 1, - "type": null, - "name": "3D" - }, - { - "title": "submodule", - "description": "Camera", - "lineNumber": 2 - }, - { - "title": "requires", - "description": null, - "lineNumber": 3, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 5, - "column": 3, - "index": 60 - } - }, - "context": { - "loc": { - "start": { - "line": 7, - "column": 0, - "index": 62 - }, - "end": { - "line": 7, - "column": 30, - "index": 92 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "3D", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "3D", - "kind": "module" - } - ], - "namespace": "3D" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This module defines the p5.Shader class" - } - ] - } - ] - }, - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 2, - "type": null, - "name": "3D" - }, - { - "title": "submodule", - "description": "Material", - "lineNumber": 3 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 4 - }, - { - "title": "requires", - "description": null, - "lineNumber": 5, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 7, - "column": 3, - "index": 116 - } - }, - "context": { - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 118 - }, - "end": { - "line": 9, - "column": 30, - "index": 148 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Shader.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "3D", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "3D", - "kind": "module" - } - ], - "namespace": "3D" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This module defines the p5.Texture class" - } - ] - } - ] - }, - "tags": [ - { - "title": "module", - "description": null, - "lineNumber": 2, - "type": null, - "name": "3D" - }, - { - "title": "submodule", - "description": "Material", - "lineNumber": 3 - }, - { - "title": "for", - "description": "p5", - "lineNumber": 4 - }, - { - "title": "requires", - "description": null, - "lineNumber": 5, - "name": "core" - } - ], - "loc": { - "start": { - "line": 1, - "column": 0, - "index": 0 - }, - "end": { - "line": 7, - "column": 3, - "index": 117 - } - }, - "context": { - "loc": { - "start": { - "line": 9, - "column": 0, - "index": 119 - }, - "end": { - "line": 9, - "column": 30, - "index": 149 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Texture.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "module", - "name": "3D", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "3D", - "kind": "module" - } - ], - "namespace": "3D" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 11, - "name": "orbitControl" - }, - { - "title": "for", - "description": "p5", - "lineNumber": 12 - }, - { - "title": "param", - "description": "sensitivity to mouse movement along X axis", - "lineNumber": 13, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "sensitivityX" - }, - { - "title": "param", - "description": "sensitivity to mouse movement along Y axis", - "lineNumber": 14, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "sensitivityY" - }, - { - "title": "param", - "description": "sensitivity to scroll movement along Z axis", - "lineNumber": 15, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "sensitivityZ" - }, - { - "title": "param", - "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.", - "lineNumber": 16, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - }, - "name": "options" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 27 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 28 - }, - { - "title": "alt", - "description": "Camera orbits around a box when mouse is hold-clicked & then moved.", - "lineNumber": 54 - } - ], - "loc": { - "start": { - "line": 11, - "column": 0, - "index": 158 - }, - "end": { - "line": 67, - "column": 3, - "index": 2710 - } - }, - "context": { - "loc": { - "start": { - "line": 71, - "column": 0, - "index": 2892 - }, - "end": { - "line": 375, - "column": 2, - "index": 13377 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/interaction.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "sensitivityX", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "sensitivity to mouse movement along X axis" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "sensitivityY", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "sensitivity to mouse movement along Y axis" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "sensitivityZ", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "sensitivity to scroll movement along Z axis" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "options", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "orbitControl", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "orbitControl", - "kind": "function" - } - ], - "namespace": "orbitControl" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 16, - "name": "debugMode" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 17 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 42 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 48 - }, - { - "title": "alt", - "description": "a 3D box is centered on a grid in a 3D sketch.", - "lineNumber": 67 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 70 - }, - { - "title": "alt", - "description": "a 3D box is centered 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.", - "lineNumber": 91 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 96 - }, - { - "title": "alt", - "description": "a 3D box is centered on a grid in a 3D sketch", - "lineNumber": 115 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 118 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 143 - } - ], - "loc": { - "start": { - "line": 378, - "column": 0, - "index": 13380 - }, - "end": { - "line": 525, - "column": 3, - "index": 17795 - } - }, - "context": { - "loc": { - "start": { - "line": 564, - "column": 0, - "index": 18731 - }, - "end": { - "line": 600, - "column": 2, - "index": 19885 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/interaction.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - }, - { - "description": "
\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
" - }, - { - "description": "
\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
" - }, - { - "description": "
\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
" - }, - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "debugMode", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "debugMode", - "kind": "function" - } - ], - "namespace": "debugMode" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "debugMode" - }, - { - "title": "param", - "description": "either GRID or AXES", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "GRID" - }, - { - "type": "NameExpression", - "name": "AXES" - } - ] - }, - "name": "mode" - } - ], - "loc": { - "start": { - "line": 527, - "column": 0, - "index": 17797 - }, - "end": { - "line": 530, - "column": 3, - "index": 17874 - } - }, - "context": { - "loc": { - "start": { - "line": 564, - "column": 0, - "index": 18731 - }, - "end": { - "line": 600, - "column": 2, - "index": 19885 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/interaction.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "mode", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either GRID or AXES" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "GRID" - }, - { - "type": "NameExpression", - "name": "AXES" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "debugMode", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "debugMode", - "kind": "function" - } - ], - "namespace": "debugMode" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "debugMode" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "GRID" - }, - { - "type": "NameExpression", - "name": "AXES" - } - ] - }, - "name": "mode" - }, - { - "title": "param", - "description": "size of one side of the grid", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "gridSize" - }, - { - "title": "param", - "description": "number of divisions in the grid", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "gridDivisions" - }, - { - "title": "param", - "description": "X axis offset from origin (0,0,0)", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "xOff" - }, - { - "title": "param", - "description": "Y axis offset from origin (0,0,0)", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "yOff" - }, - { - "title": "param", - "description": "Z axis offset from origin (0,0,0)", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "zOff" - } - ], - "loc": { - "start": { - "line": 532, - "column": 0, - "index": 17876 - }, - "end": { - "line": 540, - "column": 3, - "index": 18239 - } - }, - "context": { - "loc": { - "start": { - "line": 564, - "column": 0, - "index": 18731 - }, - "end": { - "line": 600, - "column": 2, - "index": 19885 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/interaction.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "mode", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "GRID" - }, - { - "type": "NameExpression", - "name": "AXES" - } - ] - } - }, - { - "title": "param", - "name": "gridSize", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "size of one side of the grid" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "gridDivisions", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of divisions in the grid" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "xOff", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "X axis offset from origin (0,0,0)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "yOff", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Y axis offset from origin (0,0,0)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "zOff", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Z axis offset from origin (0,0,0)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "debugMode", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "debugMode", - "kind": "function" - } - ], - "namespace": "debugMode" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "debugMode" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "GRID" - }, - { - "type": "NameExpression", - "name": "AXES" - } - ] - }, - "name": "mode" - }, - { - "title": "param", - "description": "size of axes icon", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "axesSize" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "xOff" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "yOff" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "zOff" - } - ], - "loc": { - "start": { - "line": 542, - "column": 0, - "index": 18241 - }, - "end": { - "line": 549, - "column": 3, - "index": 18424 - } - }, - "context": { - "loc": { - "start": { - "line": 564, - "column": 0, - "index": 18731 - }, - "end": { - "line": 600, - "column": 2, - "index": 19885 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/interaction.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "mode", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "GRID" - }, - { - "type": "NameExpression", - "name": "AXES" - } - ] - } - }, - { - "title": "param", - "name": "axesSize", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "size of axes icon" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "xOff", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "yOff", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "zOff", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "debugMode", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "debugMode", - "kind": "function" - } - ], - "namespace": "debugMode" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "debugMode" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "gridSize" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "gridDivisions" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "gridXOff" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "gridYOff" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "gridZOff" - }, - { - "title": "param", - "description": null, - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "axesSize" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "axesXOff" - }, - { - "title": "param", - "description": null, - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "axesYOff" - }, - { - "title": "param", - "description": null, - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "axesZOff" - } - ], - "loc": { - "start": { - "line": 551, - "column": 0, - "index": 18426 - }, - "end": { - "line": 562, - "column": 3, - "index": 18729 - } - }, - "context": { - "loc": { - "start": { - "line": 564, - "column": 0, - "index": 18731 - }, - "end": { - "line": 600, - "column": 2, - "index": 19885 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/interaction.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "gridSize", - "lineNumber": 2, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "gridDivisions", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "gridXOff", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "gridYOff", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "gridZOff", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "axesSize", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "axesXOff", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "axesYOff", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "axesZOff", - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "debugMode", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "debugMode", - "kind": "function" - } - ], - "namespace": "debugMode" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Turns off debugMode() in a 3D sketch." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 2, - "name": "noDebugMode" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 3 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 28 - } - ], - "loc": { - "start": { - "line": 602, - "column": 0, - "index": 19887 - }, - "end": { - "line": 635, - "column": 3, - "index": 20876 - } - }, - "context": { - "loc": { - "start": { - "line": 636, - "column": 0, - "index": 20877 - }, - "end": { - "line": 649, - "column": 2, - "index": 21353 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/interaction.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "noDebugMode", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "noDebugMode", - "kind": "function" - } - ], - "namespace": "noDebugMode" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates an ambient light with the given color." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 12, - "name": "ambientLight" - }, - { - "title": "param", - "description": "red or hue value relative to\n the current color range", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v1" - }, - { - "title": "param", - "description": "green or saturation value\n relative to the current color range", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v2" - }, - { - "title": "param", - "description": "blue or brightness value\n relative to the current color range", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v3" - }, - { - "title": "param", - "description": "alpha value relative to current\n color range (default is 0-255)", - "lineNumber": 19, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "alpha" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 21 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 23 - }, - { - "title": "alt", - "description": "sphere with coral color under black light", - "lineNumber": 39 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 42 - }, - { - "title": "alt", - "description": "sphere with coral color under white light", - "lineNumber": 58 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 61 - }, - { - "title": "alt", - "description": "pink ambient material cube under the ambient light", - "lineNumber": 78 - } - ], - "loc": { - "start": { - "line": 10, - "column": 0, - "index": 105 - }, - "end": { - "line": 90, - "column": 3, - "index": 2441 - } - }, - "context": { - "loc": { - "start": { - "line": 118, - "column": 0, - "index": 3060 - }, - "end": { - "line": 132, - "column": 2, - "index": 3413 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - }, - { - "description": "
\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
" - }, - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "red or hue value relative to\nthe current color range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "green or saturation value\nrelative to the current color range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v3", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "blue or brightness value\nrelative to the current color range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "alpha", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "alpha value relative to current\ncolor range (default is 0-255)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "ambientLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ambientLight", - "kind": "function" - } - ], - "namespace": "ambientLight" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "ambientLight" - }, - { - "title": "param", - "description": "number specifying value between\n white and black", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "gray" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "alpha" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 92, - "column": 0, - "index": 2443 - }, - "end": { - "line": 98, - "column": 3, - "index": 2642 - } - }, - "context": { - "loc": { - "start": { - "line": 118, - "column": 0, - "index": 3060 - }, - "end": { - "line": 132, - "column": 2, - "index": 3413 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "gray", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number specifying value between\nwhite and black" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "alpha", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "ambientLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ambientLight", - "kind": "function" - } - ], - "namespace": "ambientLight" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "ambientLight" - }, - { - "title": "param", - "description": "a color string", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 100, - "column": 0, - "index": 2644 - }, - "end": { - "line": 104, - "column": 3, - "index": 2739 - } - }, - "context": { - "loc": { - "start": { - "line": 118, - "column": 0, - "index": 3060 - }, - "end": { - "line": 132, - "column": 2, - "index": 3413 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a color string" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "ambientLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ambientLight", - "kind": "function" - } - ], - "namespace": "ambientLight" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "ambientLight" - }, - { - "title": "param", - "description": "an array containing the red,green,blue &\n and alpha components of the color", - "lineNumber": 2, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "values" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 106, - "column": 0, - "index": 2741 - }, - "end": { - "line": 111, - "column": 3, - "index": 2932 - } - }, - "context": { - "loc": { - "start": { - "line": 118, - "column": 0, - "index": 3060 - }, - "end": { - "line": 132, - "column": 2, - "index": 3413 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "values", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "an array containing the red,green,blue &\nand alpha components of the color" - } - ] - } - ] - }, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "ambientLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ambientLight", - "kind": "function" - } - ], - "namespace": "ambientLight" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "ambientLight" - }, - { - "title": "param", - "description": "color as a p5.Color", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Color" - }, - "name": "color" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 113, - "column": 0, - "index": 2934 - }, - "end": { - "line": 117, - "column": 3, - "index": 3059 - } - }, - "context": { - "loc": { - "start": { - "line": 118, - "column": 0, - "index": 3060 - }, - "end": { - "line": 132, - "column": 2, - "index": 3413 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "color as a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Color" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "ambientLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ambientLight", - "kind": "function" - } - ], - "namespace": "ambientLight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the color of the specular highlight of a non-ambient light\n(i.e. all lights except " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "ambientLight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ")." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "specularColor() affects only the lights which are created after\nit in the code." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function is used in combination with\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "specularMaterial()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nIf a geometry does not use specularMaterial(), this function\nwill have no effect." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The default color is white (255, 255, 255), which is used if\nspecularColor() is not explicitly called." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: specularColor is equivalent to the Processing function\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "lightSpecular" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 18, - "name": "specularColor" - }, - { - "title": "param", - "description": "red or hue value relative to\n the current color range", - "lineNumber": 19, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v1" - }, - { - "title": "param", - "description": "green or saturation value\n relative to the current color range", - "lineNumber": 21, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v2" - }, - { - "title": "param", - "description": "blue or brightness value\n relative to the current color range", - "lineNumber": 23, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v3" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 25 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 26 - }, - { - "title": "alt", - "description": "Sphere with specular highlight. Clicking the mouse toggles the\nspecular highlight color between red and the default white.", - "lineNumber": 68 - } - ], - "loc": { - "start": { - "line": 134, - "column": 0, - "index": 3415 - }, - "end": { - "line": 205, - "column": 3, - "index": 5731 - } - }, - "context": { - "loc": { - "start": { - "line": 232, - "column": 0, - "index": 6316 - }, - "end": { - "line": 244, - "column": 2, - "index": 6621 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "red or hue value relative to\nthe current color range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 21, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "green or saturation value\nrelative to the current color range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v3", - "lineNumber": 23, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "blue or brightness value\nrelative to the current color range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "specularColor", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "specularColor", - "kind": "function" - } - ], - "namespace": "specularColor" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "specularColor" - }, - { - "title": "param", - "description": "number specifying value between\n white and black", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "gray" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 207, - "column": 0, - "index": 5733 - }, - "end": { - "line": 212, - "column": 3, - "index": 5898 - } - }, - "context": { - "loc": { - "start": { - "line": 232, - "column": 0, - "index": 6316 - }, - "end": { - "line": 244, - "column": 2, - "index": 6621 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "gray", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number specifying value between\nwhite and black" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "specularColor", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "specularColor", - "kind": "function" - } - ], - "namespace": "specularColor" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "specularColor" - }, - { - "title": "param", - "description": "color as a CSS string", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "value" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 214, - "column": 0, - "index": 5900 - }, - "end": { - "line": 218, - "column": 3, - "index": 6003 - } - }, - "context": { - "loc": { - "start": { - "line": 232, - "column": 0, - "index": 6316 - }, - "end": { - "line": 244, - "column": 2, - "index": 6621 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "value", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "color as a CSS string" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "specularColor", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "specularColor", - "kind": "function" - } - ], - "namespace": "specularColor" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "specularColor" - }, - { - "title": "param", - "description": "color as an array containing the\n red, green, and blue components", - "lineNumber": 2, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "values" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 220, - "column": 0, - "index": 6005 - }, - "end": { - "line": 225, - "column": 3, - "index": 6187 - } - }, - "context": { - "loc": { - "start": { - "line": 232, - "column": 0, - "index": 6316 - }, - "end": { - "line": 244, - "column": 2, - "index": 6621 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "values", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "color as an array containing the\nred, green, and blue components" - } - ] - } - ] - }, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "specularColor", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "specularColor", - "kind": "function" - } - ], - "namespace": "specularColor" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "specularColor" - }, - { - "title": "param", - "description": "color as a p5.Color", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "p5.Color" - }, - "name": "color" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 3 - } - ], - "loc": { - "start": { - "line": 227, - "column": 0, - "index": 6189 - }, - "end": { - "line": 231, - "column": 3, - "index": 6315 - } - }, - "context": { - "loc": { - "start": { - "line": 232, - "column": 0, - "index": 6316 - }, - "end": { - "line": 244, - "column": 2, - "index": 6621 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "color as a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Color" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "specularColor", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "specularColor", - "kind": "function" - } - ], - "namespace": "specularColor" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a directional light with the given color and direction." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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)." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Directional lights do not have a specific point of origin, and\ntherefore cannot be positioned closer or farther away from a geometry." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A maximum of " - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "5" - } - ] - }, - { - "type": "text", - "value": " directional lights can be active at once." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 21, - "name": "directionalLight" - }, - { - "title": "param", - "description": "red or hue value relative to the current\n color range", - "lineNumber": 22, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v1" - }, - { - "title": "param", - "description": "green or saturation value relative to the\n current color range", - "lineNumber": 24, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v2" - }, - { - "title": "param", - "description": "blue or brightness value relative to the\n current color range", - "lineNumber": 26, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v3" - }, - { - "title": "param", - "description": "x component of direction (inclusive range of -1 to 1)", - "lineNumber": 28, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y component of direction (inclusive range of -1 to 1)", - "lineNumber": 29, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "z component of direction (inclusive range of -1 to 1)", - "lineNumber": 30, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 31 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 32 - }, - { - "title": "alt", - "description": "scene with sphere and directional light. The direction of\nthe light is controlled with the mouse position.", - "lineNumber": 53 - } - ], - "loc": { - "start": { - "line": 246, - "column": 0, - "index": 6623 - }, - "end": { - "line": 302, - "column": 3, - "index": 8912 - } - }, - "context": { - "loc": { - "start": { - "line": 330, - "column": 0, - "index": 9654 - }, - "end": { - "line": 371, - "column": 2, - "index": 10692 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 22, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "red or hue value relative to the current\ncolor range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 24, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "green or saturation value relative to the\ncurrent color range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v3", - "lineNumber": 26, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "blue or brightness value relative to the\ncurrent color range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x", - "lineNumber": 28, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x component of direction (inclusive range of -1 to 1)" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 29, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y component of direction (inclusive range of -1 to 1)" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 30, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z component of direction (inclusive range of -1 to 1)" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "directionalLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "directionalLight", - "kind": "function" - } - ], - "namespace": "directionalLight" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "directionalLight" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v1" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v2" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v3" - }, - { - "title": "param", - "description": "direction of light as a\n p5.Vector", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "direction" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 304, - "column": 0, - "index": 8914 - }, - "end": { - "line": 312, - "column": 3, - "index": 9170 - } - }, - "context": { - "loc": { - "start": { - "line": 330, - "column": 0, - "index": 9654 - }, - "end": { - "line": 371, - "column": 2, - "index": 10692 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v3", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "direction", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "direction of light as a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "directionalLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "directionalLight", - "kind": "function" - } - ], - "namespace": "directionalLight" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "directionalLight" - }, - { - "title": "param", - "description": "color as a p5.Color,\n as an array, or as a CSS string", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "color" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 314, - "column": 0, - "index": 9172 - }, - "end": { - "line": 322, - "column": 3, - "index": 9510 - } - }, - "context": { - "loc": { - "start": { - "line": 330, - "column": 0, - "index": 9654 - }, - "end": { - "line": 371, - "column": 2, - "index": 10692 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "color as a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\nas an array, or as a CSS string" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "param", - "name": "x", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "directionalLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "directionalLight", - "kind": "function" - } - ], - "namespace": "directionalLight" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "directionalLight" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "color" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "direction" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 324, - "column": 0, - "index": 9512 - }, - "end": { - "line": 329, - "column": 3, - "index": 9653 - } - }, - "context": { - "loc": { - "start": { - "line": 330, - "column": 0, - "index": 9654 - }, - "end": { - "line": 371, - "column": 2, - "index": 10692 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "param", - "name": "direction", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "directionalLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "directionalLight", - "kind": "function" - } - ], - "namespace": "directionalLight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a point light with the given color and position." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A maximum of " - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "5" - } - ] - }, - { - "type": "text", - "value": " point lights can be active at once." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 15, - "name": "pointLight" - }, - { - "title": "param", - "description": "red or hue value relative to the current\n color range", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v1" - }, - { - "title": "param", - "description": "green or saturation value relative to the\n current color range", - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v2" - }, - { - "title": "param", - "description": "blue or brightness value relative to the\n current color range", - "lineNumber": 20, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v3" - }, - { - "title": "param", - "description": "x component of position", - "lineNumber": 22, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y component of position", - "lineNumber": 23, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "z component of position", - "lineNumber": 24, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 25 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 26 - }, - { - "title": "alt", - "description": "scene with sphere and point light. The position of\nthe light is controlled with the mouse position.", - "lineNumber": 54 - } - ], - "loc": { - "start": { - "line": 373, - "column": 0, - "index": 10694 - }, - "end": { - "line": 430, - "column": 3, - "index": 12734 - } - }, - "context": { - "loc": { - "start": { - "line": 457, - "column": 0, - "index": 13414 - }, - "end": { - "line": 495, - "column": 2, - "index": 14325 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "red or hue value relative to the current\ncolor range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "green or saturation value relative to the\ncurrent color range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v3", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "blue or brightness value relative to the\ncurrent color range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x", - "lineNumber": 22, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x component of position" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 23, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y component of position" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 24, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z component of position" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "pointLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "pointLight", - "kind": "function" - } - ], - "namespace": "pointLight" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "pointLight" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v1" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v2" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v3" - }, - { - "title": "param", - "description": "of light as a p5.Vector", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "position" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 6 - } - ], - "loc": { - "start": { - "line": 432, - "column": 0, - "index": 12736 - }, - "end": { - "line": 439, - "column": 3, - "index": 12943 - } - }, - "context": { - "loc": { - "start": { - "line": 457, - "column": 0, - "index": 13414 - }, - "end": { - "line": 495, - "column": 2, - "index": 14325 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v3", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "position", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "of light as a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "pointLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "pointLight", - "kind": "function" - } - ], - "namespace": "pointLight" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "pointLight" - }, - { - "title": "param", - "description": "color as a p5.Color,\n as an array, or as a CSS string", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "color" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 441, - "column": 0, - "index": 12945 - }, - "end": { - "line": 449, - "column": 3, - "index": 13277 - } - }, - "context": { - "loc": { - "start": { - "line": 457, - "column": 0, - "index": 13414 - }, - "end": { - "line": 495, - "column": 2, - "index": 14325 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "color as a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\nas an array, or as a CSS string" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "param", - "name": "x", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "pointLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "pointLight", - "kind": "function" - } - ], - "namespace": "pointLight" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "pointLight" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "color" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "position" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 451, - "column": 0, - "index": 13279 - }, - "end": { - "line": 456, - "column": 3, - "index": 13413 - } - }, - "context": { - "loc": { - "start": { - "line": 457, - "column": 0, - "index": 13414 - }, - "end": { - "line": 495, - "column": 2, - "index": 14325 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "param", - "name": "position", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "pointLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "pointLight", - "kind": "function" - } - ], - "namespace": "pointLight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates an image light with the given image." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: The image's diffuse light will be affected by fill()\nand the specular reflections will be affected by specularMaterial()\nand shininess()." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 19, - "name": "imageLight" - }, - { - "title": "param", - "description": "image for the background", - "lineNumber": 20, - "type": { - "type": "NameExpression", - "name": "p5.image" - }, - "name": "img" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 21 - }, - { - "title": "alt", - "description": "image light example", - "lineNumber": 56 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 58 - }, - { - "title": "alt", - "description": "light with slider having a slider for varying roughness", - "lineNumber": 95 - } - ], - "loc": { - "start": { - "line": 497, - "column": 0, - "index": 14327 - }, - "end": { - "line": 594, - "column": 3, - "index": 16748 - } - }, - "context": { - "loc": { - "start": { - "line": 595, - "column": 0, - "index": 16749 - }, - "end": { - "line": 600, - "column": 2, - "index": 16980 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - }, - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "img", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "image for the background" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.image" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "imageLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "imageLight", - "kind": "function" - } - ], - "namespace": "imageLight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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)." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 10, - "name": "lights" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 11 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 12 - }, - { - "title": "alt", - "description": "the light is partially ambient and partially directional", - "lineNumber": 32 - } - ], - "loc": { - "start": { - "line": 602, - "column": 0, - "index": 16982 - }, - "end": { - "line": 636, - "column": 3, - "index": 17943 - } - }, - "context": { - "loc": { - "start": { - "line": 637, - "column": 0, - "index": 17944 - }, - "end": { - "line": 644, - "column": 2, - "index": 18189 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "lights", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "lights", - "kind": "function" - } - ], - "namespace": "lights" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the falloff rate for " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pointLight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nand " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "spotLight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "lightFalloff() affects only the lights which are created after it\nin the code." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "inlineCode", - "value": "constant" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "linear" - }, - { - "type": "text", - "value": ", an " - }, - { - "type": "inlineCode", - "value": "quadratic" - }, - { - "type": "text", - "value": " parameters are used to calculate falloff as follows:" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "d = distance from light position to vertex position" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "falloff = 1 / (CONSTANT + d * LINEAR + (d * d) * QUADRATIC)" - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 13, - "name": "lightFalloff" - }, - { - "title": "param", - "description": "CONSTANT value for determining falloff", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "constant" - }, - { - "title": "param", - "description": "LINEAR value for determining falloff", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "linear" - }, - { - "title": "param", - "description": "QUADRATIC value for determining falloff", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "quadratic" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 17 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 18 - }, - { - "title": "alt", - "description": "Two spheres with different falloff values show different intensity of light", - "lineNumber": 53 - } - ], - "loc": { - "start": { - "line": 646, - "column": 0, - "index": 18191 - }, - "end": { - "line": 701, - "column": 3, - "index": 19688 - } - }, - "context": { - "loc": { - "start": { - "line": 702, - "column": 0, - "index": 19689 - }, - "end": { - "line": 746, - "column": 2, - "index": 20913 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "constant", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "CONSTANT value for determining falloff" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "linear", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "LINEAR value for determining falloff" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "quadratic", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "QUADRATIC value for determining falloff" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "lightFalloff", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "lightFalloff", - "kind": "function" - } - ], - "namespace": "lightFalloff" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a spot light with the given color, position,\nlight direction, angle, and concentration." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Like a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pointLight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", a spotLight()\nemits light from a specific point (position). It has a different effect\nwhen it is positioned farther vs. nearer an object." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "However, unlike a pointLight(), the light is emitted in " - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "one direction" - } - ] - }, - { - "type": "text", - "value": "\nalong a conical shape. The shape of the cone can be controlled using\nthe " - }, - { - "type": "inlineCode", - "value": "angle" - }, - { - "type": "text", - "value": " and " - }, - { - "type": "inlineCode", - "value": "concentration" - }, - { - "type": "text", - "value": " parameters." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The " - }, - { - "type": "inlineCode", - "value": "angle" - }, - { - "type": "text", - "value": " parameter is used to\ndetermine the radius of the cone. And the " - }, - { - "type": "inlineCode", - "value": "concentration" - }, - { - "type": "text", - "value": "\nparameter is used to focus the light towards the center of\nthe cone. Both parameters are optional, however if you want\nto specify " - }, - { - "type": "inlineCode", - "value": "concentration" - }, - { - "type": "text", - "value": ", you must also specify " - }, - { - "type": "inlineCode", - "value": "angle" - }, - { - "type": "text", - "value": ".\nThe minimum concentration value is 1." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A maximum of " - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "5" - } - ] - }, - { - "type": "text", - "value": " spot lights can be active at once." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 26, - "name": "spotLight" - }, - { - "title": "param", - "description": "red or hue value relative to the current color range", - "lineNumber": 27, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v1" - }, - { - "title": "param", - "description": "green or saturation value relative to the current color range", - "lineNumber": 28, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v2" - }, - { - "title": "param", - "description": "blue or brightness value relative to the current color range", - "lineNumber": 29, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v3" - }, - { - "title": "param", - "description": "x component of position", - "lineNumber": 30, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": "y component of position", - "lineNumber": 31, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": "z component of position", - "lineNumber": 32, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z" - }, - { - "title": "param", - "description": "x component of light direction (inclusive range of -1 to 1)", - "lineNumber": 33, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rx" - }, - { - "title": "param", - "description": "y component of light direction (inclusive range of -1 to 1)", - "lineNumber": 34, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "ry" - }, - { - "title": "param", - "description": "z component of light direction (inclusive range of -1 to 1)", - "lineNumber": 35, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rz" - }, - { - "title": "param", - "description": "angle of cone. Defaults to PI/3", - "lineNumber": 36, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "angle" - }, - { - "title": "param", - "description": "concentration of cone. Defaults to 100", - "lineNumber": 37, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "concentration" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 38 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 40 - }, - { - "title": "alt", - "description": "scene with sphere and spot light. The position of\nthe light is controlled with the mouse position.", - "lineNumber": 69 - } - ], - "loc": { - "start": { - "line": 748, - "column": 0, - "index": 20915 - }, - "end": { - "line": 820, - "column": 3, - "index": 23991 - } - }, - "context": { - "loc": { - "start": { - "line": 896, - "column": 0, - "index": 26474 - }, - "end": { - "line": 1107, - "column": 2, - "index": 31925 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 27, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "red or hue value relative to the current color range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 28, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "green or saturation value relative to the current color range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v3", - "lineNumber": 29, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "blue or brightness value relative to the current color range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x", - "lineNumber": 30, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x component of position" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 31, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y component of position" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 32, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z component of position" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "rx", - "lineNumber": 33, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x component of light direction (inclusive range of -1 to 1)" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "ry", - "lineNumber": 34, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y component of light direction (inclusive range of -1 to 1)" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "rz", - "lineNumber": 35, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z component of light direction (inclusive range of -1 to 1)" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "angle", - "lineNumber": 36, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "angle of cone. Defaults to PI/3" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "concentration", - "lineNumber": 37, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "concentration of cone. Defaults to 100" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "spotLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "spotLight", - "kind": "function" - } - ], - "namespace": "spotLight" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "spotLight" - }, - { - "title": "param", - "description": "color as a p5.Color,\n as an array, or as a CSS string", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "color" - }, - { - "title": "param", - "description": "position of light as a p5.Vector", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "position" - }, - { - "title": "param", - "description": "direction of light as a p5.Vector", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "direction" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "angle" - }, - { - "title": "param", - "description": null, - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "concentration" - } - ], - "loc": { - "start": { - "line": 821, - "column": 0, - "index": 23992 - }, - "end": { - "line": 829, - "column": 3, - "index": 24534 - } - }, - "context": { - "loc": { - "start": { - "line": 896, - "column": 0, - "index": 26474 - }, - "end": { - "line": 1107, - "column": 2, - "index": 31925 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "color as a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\nas an array, or as a CSS string" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "param", - "name": "position", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "position of light as a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "direction", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "direction of light as a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Vector" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "angle", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "concentration", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "spotLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "spotLight", - "kind": "function" - } - ], - "namespace": "spotLight" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "spotLight" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v1" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v2" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v3" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "position" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "direction" - }, - { - "title": "param", - "description": null, - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "angle" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "concentration" - } - ], - "loc": { - "start": { - "line": 830, - "column": 0, - "index": 24535 - }, - "end": { - "line": 839, - "column": 3, - "index": 24783 - } - }, - "context": { - "loc": { - "start": { - "line": 896, - "column": 0, - "index": 26474 - }, - "end": { - "line": 1107, - "column": 2, - "index": 31925 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v3", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "position", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "direction", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "angle", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "concentration", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "spotLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "spotLight", - "kind": "function" - } - ], - "namespace": "spotLight" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "spotLight" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "color" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "direction" - }, - { - "title": "param", - "description": null, - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "angle" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "concentration" - } - ], - "loc": { - "start": { - "line": 840, - "column": 0, - "index": 24784 - }, - "end": { - "line": 849, - "column": 3, - "index": 25124 - } - }, - "context": { - "loc": { - "start": { - "line": 896, - "column": 0, - "index": 26474 - }, - "end": { - "line": 1107, - "column": 2, - "index": 31925 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "param", - "name": "x", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "direction", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "angle", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "concentration", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "spotLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "spotLight", - "kind": "function" - } - ], - "namespace": "spotLight" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "spotLight" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "color" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "position" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rx" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "ry" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rz" - }, - { - "title": "param", - "description": null, - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "angle" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "concentration" - } - ], - "loc": { - "start": { - "line": 850, - "column": 0, - "index": 25125 - }, - "end": { - "line": 859, - "column": 3, - "index": 25467 - } - }, - "context": { - "loc": { - "start": { - "line": 896, - "column": 0, - "index": 26474 - }, - "end": { - "line": 1107, - "column": 2, - "index": 31925 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "param", - "name": "position", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "rx", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "ry", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "rz", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "angle", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "concentration", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "spotLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "spotLight", - "kind": "function" - } - ], - "namespace": "spotLight" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "spotLight" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v1" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v2" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v3" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "direction" - }, - { - "title": "param", - "description": null, - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "angle" - }, - { - "title": "param", - "description": null, - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "concentration" - } - ], - "loc": { - "start": { - "line": 860, - "column": 0, - "index": 25468 - }, - "end": { - "line": 871, - "column": 3, - "index": 25761 - } - }, - "context": { - "loc": { - "start": { - "line": 896, - "column": 0, - "index": 26474 - }, - "end": { - "line": 1107, - "column": 2, - "index": 31925 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v3", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "direction", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "angle", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "concentration", - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "spotLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "spotLight", - "kind": "function" - } - ], - "namespace": "spotLight" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "spotLight" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v1" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v2" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v3" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - }, - "name": "position" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rx" - }, - { - "title": "param", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "ry" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rz" - }, - { - "title": "param", - "description": null, - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "angle" - }, - { - "title": "param", - "description": null, - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "concentration" - } - ], - "loc": { - "start": { - "line": 872, - "column": 0, - "index": 25762 - }, - "end": { - "line": 883, - "column": 3, - "index": 26057 - } - }, - "context": { - "loc": { - "start": { - "line": 896, - "column": 0, - "index": 26474 - }, - "end": { - "line": 1107, - "column": 2, - "index": 31925 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v3", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "position", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Vector" - } - }, - { - "title": "param", - "name": "rx", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "ry", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "rz", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "angle", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "concentration", - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "spotLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "spotLight", - "kind": "function" - } - ], - "namespace": "spotLight" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "spotLight" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "color" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "z" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rx" - }, - { - "title": "param", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "ry" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "rz" - }, - { - "title": "param", - "description": null, - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "angle" - }, - { - "title": "param", - "description": null, - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "concentration" - } - ], - "loc": { - "start": { - "line": 884, - "column": 0, - "index": 26058 - }, - "end": { - "line": 895, - "column": 3, - "index": 26473 - } - }, - "context": { - "loc": { - "start": { - "line": 896, - "column": 0, - "index": 26474 - }, - "end": { - "line": 1107, - "column": 2, - "index": 31925 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - }, - { - "title": "param", - "name": "x", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "rx", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "ry", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "rz", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "angle", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "concentration", - "lineNumber": 10, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "spotLight", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "spotLight", - "kind": "function" - } - ], - "namespace": "spotLight" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Removes all lights present in a sketch." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "All subsequent geometry is rendered without lighting (until a new\nlight is created with a call to one of the lighting functions\n(" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "lights()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "ambientLight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "directionalLight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pointLight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "spotLight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ")." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 11, - "name": "noLights" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 12 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 13 - }, - { - "title": "alt", - "description": "Three white spheres. Each appears as a different\ncolor due to lighting.", - "lineNumber": 44 - } - ], - "loc": { - "start": { - "line": 1109, - "column": 0, - "index": 31927 - }, - "end": { - "line": 1156, - "column": 3, - "index": 33064 - } - }, - "context": { - "loc": { - "start": { - "line": 1157, - "column": 0, - "index": 33065 - }, - "end": { - "line": 1189, - "column": 2, - "index": 34201 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/light.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "noLights", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "noLights", - "kind": "function" - } - ], - "namespace": "noLights" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Load a 3d model from an OBJ or STL file." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadModel()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " should be placed inside of " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "preload()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nThis allows the model to load fully before the rest of your code is run." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadModel()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "scale()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Also, the support for colored STL files is not present. STL files with color will be\nrendered without color properties." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Options can include:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "path" - }, - { - "type": "text", - "value": ": Specifies the location or path of the 3D model file for loading." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "normalize" - }, - { - "type": "text", - "value": ": Enables standardized size scaling during loading if set to true." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "successCallback" - }, - { - "type": "text", - "value": ": Callback for post-loading actions with the 3D model object." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "failureCallback" - }, - { - "type": "text", - "value": ": Handles errors if model loading fails, receiving an event error." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "fileType" - }, - { - "type": "text", - "value": ": Defines the file extension of the model." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "flipU" - }, - { - "type": "text", - "value": ": Flips the U texture coordinates of the model." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "flipV" - }, - { - "type": "text", - "value": ": Flips the V texture coordinates of the model." - } - ] - } - ] - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 25, - "name": "loadModel" - }, - { - "title": "param", - "description": "Path of the model to be loaded", - "lineNumber": 26, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "path" - }, - { - "title": "param", - "description": "If true, scale the model to a\n standardized size when loading", - "lineNumber": 27, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "normalize" - }, - { - "title": "param", - "description": "Function to be called\n once the model is loaded. Will be passed\n the 3D model object.", - "lineNumber": 29, - "type": { - "type": "OptionalType", - "expression": { - "type": "FunctionType", - "params": [ - { - "type": "NameExpression", - "name": "p5.Geometry" - } - ], - "result": null - } - }, - "name": "successCallback" - }, - { - "title": "param", - "description": "called with event error if\n the model fails to load.", - "lineNumber": 32, - "type": { - "type": "OptionalType", - "expression": { - "type": "FunctionType", - "params": [ - { - "type": "NameExpression", - "name": "Event" - } - ], - "result": null - } - }, - "name": "failureCallback" - }, - { - "title": "param", - "description": "The file extension of the model\n (.stl, .obj).", - "lineNumber": 34, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "fileType" - }, - { - "title": "return", - "description": "the p5.Geometry object", - "lineNumber": 36, - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 38 - }, - { - "title": "alt", - "description": "Vertically rotating 3-d octahedron.", - "lineNumber": 62 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 65 - }, - { - "title": "alt", - "description": "Vertically rotating 3-d teapot with red, green and blue gradient.", - "lineNumber": 92 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 160 - }, - "end": { - "line": 106, - "column": 3, - "index": 3601 - } - }, - "context": { - "loc": { - "start": { - "line": 127, - "column": 0, - "index": 4293 - }, - "end": { - "line": 225, - "column": 2, - "index": 6629 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/loading.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - }, - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "path", - "lineNumber": 26, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Path of the model to be loaded" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "normalize", - "lineNumber": 27, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If true, scale the model to a\nstandardized size when loading" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - }, - { - "title": "param", - "name": "successCallback", - "lineNumber": 29, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Function to be called\nonce the model is loaded. Will be passed\nthe 3D model object." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "FunctionType", - "params": [ - { - "type": "NameExpression", - "name": "p5.Geometry" - } - ], - "result": null - } - } - }, - { - "title": "param", - "name": "failureCallback", - "lineNumber": 32, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "called with event error if\nthe model fails to load." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "FunctionType", - "params": [ - { - "type": "NameExpression", - "name": "Event" - } - ], - "result": null - } - } - }, - { - "title": "param", - "name": "fileType", - "lineNumber": 34, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The file extension of the model\n(" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".stl" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".obj" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ")." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Geometry" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "loadModel", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "loadModel", - "kind": "function" - } - ], - "namespace": "loadModel" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "loadModel" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "path" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "FunctionType", - "params": [ - { - "type": "NameExpression", - "name": "p5.Geometry" - } - ], - "result": null - } - }, - "name": "successCallback" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "FunctionType", - "params": [ - { - "type": "NameExpression", - "name": "Event" - } - ], - "result": null - } - }, - "name": "failureCallback" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "fileType" - }, - { - "title": "return", - "description": "the p5.Geometry object", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - } - } - ], - "loc": { - "start": { - "line": 107, - "column": 0, - "index": 3602 - }, - "end": { - "line": 114, - "column": 3, - "index": 3862 - } - }, - "context": { - "loc": { - "start": { - "line": 127, - "column": 0, - "index": 4293 - }, - "end": { - "line": 225, - "column": 2, - "index": 6629 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/loading.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "path", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "successCallback", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "FunctionType", - "params": [ - { - "type": "NameExpression", - "name": "p5.Geometry" - } - ], - "result": null - } - } - }, - { - "title": "param", - "name": "failureCallback", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "FunctionType", - "params": [ - { - "type": "NameExpression", - "name": "Event" - } - ], - "result": null - } - } - }, - { - "title": "param", - "name": "fileType", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Geometry" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "loadModel", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "loadModel", - "kind": "function" - } - ], - "namespace": "loadModel" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "loadModel" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "path" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - }, - "name": "options" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "FunctionType", - "params": [ - { - "type": "NameExpression", - "name": "p5.Geometry" - } - ], - "result": null - } - }, - "name": "options.successCallback" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "FunctionType", - "params": [ - { - "type": "NameExpression", - "name": "Event" - } - ], - "result": null - } - }, - "name": "options.failureCallback" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - }, - "name": "options.fileType" - }, - { - "title": "param", - "description": null, - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "boolean" - } - }, - "name": "options.normalize" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "boolean" - } - }, - "name": "options.flipU" - }, - { - "title": "param", - "description": null, - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "boolean" - } - }, - "name": "options.flipV" - }, - { - "title": "return", - "description": "the p5.Geometry object", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - } - } - ], - "loc": { - "start": { - "line": 115, - "column": 0, - "index": 3863 - }, - "end": { - "line": 126, - "column": 3, - "index": 4292 - } - }, - "context": { - "loc": { - "start": { - "line": 127, - "column": 0, - "index": 4293 - }, - "end": { - "line": 225, - "column": 2, - "index": 6629 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/loading.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "path", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "options", - "lineNumber": 3, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - }, - "properties": [ - { - "title": "param", - "name": "options.successCallback", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "FunctionType", - "params": [ - { - "type": "NameExpression", - "name": "p5.Geometry" - } - ], - "result": null - } - } - }, - { - "title": "param", - "name": "options.failureCallback", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "FunctionType", - "params": [ - { - "type": "NameExpression", - "name": "Event" - } - ], - "result": null - } - } - }, - { - "title": "param", - "name": "options.fileType", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "String" - } - } - }, - { - "title": "param", - "name": "options.normalize", - "lineNumber": 7, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "boolean" - } - } - }, - { - "title": "param", - "name": "options.flipU", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "boolean" - } - } - }, - { - "title": "param", - "name": "options.flipV", - "lineNumber": 9, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "boolean" - } - } - } - ] - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Geometry" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "loadModel", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "loadModel", - "kind": "function" - } - ], - "namespace": "loadModel" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Parse OBJ lines into model. For reference, this is what a simple model of a\nsquare might look like:" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "f 4 3 2 1" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 227, - "column": 0, - "index": 6631 - }, - "end": { - "line": 237, - "column": 3, - "index": 6839 - } - }, - "context": { - "loc": { - "start": { - "line": 238, - "column": 0, - "index": 6840 - }, - "end": { - "line": 336, - "column": 1, - "index": 10657 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/loading.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "model", - "lineNumber": 238 - }, - { - "title": "param", - "name": "lines", - "lineNumber": 238 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "parseObj", - "kind": "function", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "parseObj", - "kind": "function" - } - ], - "namespace": "parseObj" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "STL files can be of two types, ASCII and Binary," - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "We need to convert the arrayBuffer to an array of strings,\nto parse it as an ASCII file." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 338, - "column": 0, - "index": 10659 - }, - "end": { - "line": 343, - "column": 3, - "index": 10816 - } - }, - "context": { - "loc": { - "start": { - "line": 344, - "column": 0, - "index": 10817 - }, - "end": { - "line": 363, - "column": 1, - "index": 11370 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/loading.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "model", - "lineNumber": 344 - }, - { - "title": "param", - "name": "buffer", - "lineNumber": 344 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "parseSTL", - "kind": "function", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "parseSTL", - "kind": "function" - } - ], - "namespace": "parseSTL" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function checks if the file is in ASCII format or in Binary format" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "It is done by searching keyword " - }, - { - "type": "inlineCode", - "value": "solid" - }, - { - "type": "text", - "value": " at the start of the file." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An ASCII STL data must begin with " - }, - { - "type": "inlineCode", - "value": "solid" - }, - { - "type": "text", - "value": " as the first six bytes.\nHowever, ASCII STLs lacking the SPACE after the " - }, - { - "type": "inlineCode", - "value": "d" - }, - { - "type": "text", - "value": " are known to be\nplentiful. So, check the first 5 bytes for " - }, - { - "type": "inlineCode", - "value": "solid" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Several encodings, such as UTF-8, precede the text with up to 5 bytes:\n" - }, - { - "type": "link", - "title": null, - "url": "https://en.wikipedia.org/wiki/Byte_order_mark#Byte_order_marks_by_encoding", - "children": [ - { - "type": "text", - "value": "https://en.wikipedia.org/wiki/Byte_order_mark#Byte_order_marks_by_encoding" - } - ] - }, - { - "type": "text", - "value": "\nSearch for " - }, - { - "type": "inlineCode", - "value": "solid" - }, - { - "type": "text", - "value": " to start anywhere after those prefixes." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 365, - "column": 0, - "index": 11372 - }, - "end": { - "line": 377, - "column": 3, - "index": 11941 - } - }, - "context": { - "loc": { - "start": { - "line": 378, - "column": 0, - "index": 11942 - }, - "end": { - "line": 390, - "column": 1, - "index": 12380 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/loading.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "data", - "lineNumber": 378 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "isBinary", - "kind": "function", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "isBinary", - "kind": "function" - } - ], - "namespace": "isBinary" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function matches the " - }, - { - "type": "inlineCode", - "value": "query" - }, - { - "type": "text", - "value": " at the provided " - }, - { - "type": "inlineCode", - "value": "offset" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 392, - "column": 0, - "index": 12382 - }, - "end": { - "line": 394, - "column": 3, - "index": 12451 - } - }, - "context": { - "loc": { - "start": { - "line": 395, - "column": 0, - "index": 12452 - }, - "end": { - "line": 402, - "column": 1, - "index": 12734 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/loading.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "query", - "lineNumber": 395 - }, - { - "title": "param", - "name": "reader", - "lineNumber": 395 - }, - { - "title": "param", - "name": "offset", - "lineNumber": 395 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "matchDataViewAt", - "kind": "function", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "matchDataViewAt", - "kind": "function" - } - ], - "namespace": "matchDataViewAt" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This function parses the Binary STL files.\n" - }, - { - "type": "link", - "title": null, - "url": "https://en.wikipedia.org/wiki/STL_%28file_format%29#Binary_STL", - "children": [ - { - "type": "text", - "value": "https://en.wikipedia.org/wiki/STL_%28file_format%29#Binary_STL" - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Currently there is no support for the colors provided in STL files." - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 404, - "column": 0, - "index": 12736 - }, - "end": { - "line": 409, - "column": 3, - "index": 12929 - } - }, - "context": { - "loc": { - "start": { - "line": 410, - "column": 0, - "index": 12930 - }, - "end": { - "line": 490, - "column": 1, - "index": 15249 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/loading.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "model", - "lineNumber": 410 - }, - { - "title": "param", - "name": "buffer", - "lineNumber": 410 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "parseBinarySTL", - "kind": "function", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "parseBinarySTL", - "kind": "function" - } - ], - "namespace": "parseBinarySTL" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "ASCII STL file starts with " - }, - { - "type": "inlineCode", - "value": "solid 'nameOfFile'" - }, - { - "type": "text", - "value": "\nThen contain the normal of the face, starting with " - }, - { - "type": "inlineCode", - "value": "facet normal" - }, - { - "type": "text", - "value": "\nNext contain a keyword indicating the start of face vertex, " - }, - { - "type": "inlineCode", - "value": "outer loop" - }, - { - "type": "text", - "value": "\nNext comes the three vertex, starting with " - }, - { - "type": "inlineCode", - "value": "vertex x y z" - }, - { - "type": "text", - "value": "\nVertices ends with " - }, - { - "type": "inlineCode", - "value": "endloop" - }, - { - "type": "text", - "value": "\nFace ends with " - }, - { - "type": "inlineCode", - "value": "endfacet" - }, - { - "type": "text", - "value": "\nNext face starts with " - }, - { - "type": "inlineCode", - "value": "facet normal" - }, - { - "type": "text", - "value": "\nThe end of the file is indicated by " - }, - { - "type": "inlineCode", - "value": "endsolid" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 492, - "column": 0, - "index": 15251 - }, - "end": { - "line": 501, - "column": 3, - "index": 15666 - } - }, - "context": { - "loc": { - "start": { - "line": 502, - "column": 0, - "index": 15667 - }, - "end": { - "line": 634, - "column": 1, - "index": 19399 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/loading.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "model", - "lineNumber": 502 - }, - { - "title": "param", - "name": "lines", - "lineNumber": 502 - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "parseASCIISTL", - "kind": "function", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "parseASCIISTL", - "kind": "function" - } - ], - "namespace": "parseASCIISTL" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Render a 3d model to the screen." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 3, - "name": "model" - }, - { - "title": "param", - "description": "Loaded 3d model to be rendered", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - }, - "name": "model" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 5 - }, - { - "title": "alt", - "description": "Vertically rotating 3-d octahedron.", - "lineNumber": 29 - } - ], - "loc": { - "start": { - "line": 636, - "column": 0, - "index": 19401 - }, - "end": { - "line": 667, - "column": 3, - "index": 20026 - } - }, - "context": { - "loc": { - "start": { - "line": 668, - "column": 0, - "index": 20027 - }, - "end": { - "line": 684, - "column": 2, - "index": 20453 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/loading.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "model", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Loaded 3d model to be rendered" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "model", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "model", - "kind": "function" - } - ], - "namespace": "model" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Shader" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object\nfrom the provided vertex and fragment shader files." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The shader files are loaded asynchronously in the\nbackground, so this method should be used in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "preload()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createShader example" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note, shaders can only be used in WEBGL mode." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 12, - "name": "loadShader" - }, - { - "title": "param", - "description": "path to file containing vertex shader\nsource code", - "lineNumber": 13, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "vertFilename" - }, - { - "title": "param", - "description": "path to file containing fragment shader\nsource code", - "lineNumber": 15, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "fragFilename" - }, - { - "title": "param", - "description": "callback to be executed after loadShader\ncompletes. On success, the p5.Shader object is passed as the first argument.", - "lineNumber": 17, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "callback" - }, - { - "title": "param", - "description": "callback to be executed when an error\noccurs inside loadShader. On error, the error is passed as the first\nargument.", - "lineNumber": 19, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "errorCallback" - }, - { - "title": "return", - "description": "a shader object created from the provided\nvertex and fragment shader files.", - "lineNumber": 22, - "type": { - "type": "NameExpression", - "name": "p5.Shader" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 25 - }, - { - "title": "alt", - "description": "zooming Mandelbrot set. a colorful, infinitely detailed fractal.", - "lineNumber": 49 - } - ], - "loc": { - "start": { - "line": 12, - "column": 0, - "index": 178 - }, - "end": { - "line": 63, - "column": 3, - "index": 2040 - } - }, - "context": { - "loc": { - "start": { - "line": 64, - "column": 0, - "index": 2041 - }, - "end": { - "line": 113, - "column": 2, - "index": 2932 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/material.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "vertFilename", - "lineNumber": 13, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "path to file containing vertex shader\nsource code" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "fragFilename", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "path to file containing fragment shader\nsource code" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "callback to be executed after loadShader\ncompletes. On success, the p5.Shader object is passed as the first argument." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - }, - { - "title": "param", - "name": "errorCallback", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "callback to be executed when an error\noccurs inside loadShader. On error, the error is passed as the first\nargument." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a shader object created from the provided\nvertex and fragment shader files." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Shader" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "loadShader", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "loadShader", - "kind": "function" - } - ], - "namespace": "loadShader" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Shader" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object\nfrom the provided vertex and fragment shader code." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note, shaders can only be used in WEBGL mode." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 9, - "name": "createShader" - }, - { - "title": "param", - "description": "source code for the vertex shader", - "lineNumber": 10, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "vertSrc" - }, - { - "title": "param", - "description": "source code for the fragment shader", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "fragSrc" - }, - { - "title": "returns", - "description": "a shader object created from the provided\nvertex and fragment shaders.", - "lineNumber": 12, - "type": { - "type": "NameExpression", - "name": "p5.Shader" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 15 - }, - { - "title": "alt", - "description": "zooming Mandelbrot set. a colorful, infinitely detailed fractal.", - "lineNumber": 79 - } - ], - "loc": { - "start": { - "line": 115, - "column": 0, - "index": 2934 - }, - "end": { - "line": 196, - "column": 3, - "index": 5307 - } - }, - "context": { - "loc": { - "start": { - "line": 197, - "column": 0, - "index": 5308 - }, - "end": { - "line": 200, - "column": 2, - "index": 5479 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/material.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "vertSrc", - "lineNumber": 10, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "source code for the vertex shader" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "fragSrc", - "lineNumber": 11, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "source code for the fragment shader" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a shader object created from the provided\nvertex and fragment shaders." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Shader" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createShader", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createShader", - "kind": "function" - } - ], - "namespace": "createShader" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Shader" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " using only a fragment shader, as a convenience method for creating image effects.\nIt's like " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createShader()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " but with a default vertex shader included." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createFilterShader()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " is intended to be used along with " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "filter()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " for filtering the contents of a canvas.\nA filter shader will not be applied to any geometries." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The fragment shader receives some uniforms:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "sampler2D tex0" - }, - { - "type": "text", - "value": ", which contains the canvas contents as a texture" - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "vec2 canvasSize" - }, - { - "type": "text", - "value": ", which is the p5 width and height of the canvas (not including pixel density)" - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "vec2 texelSize" - }, - { - "type": "text", - "value": ", which is the size of a physical pixel including pixel density (" - }, - { - "type": "inlineCode", - "value": "1.0/(width*density)" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "1.0/(height*density)" - }, - { - "type": "text", - "value": ")" - } - ] - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "For more info about filters and shaders, see Adam Ferriss' " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "repo of shader examples" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nor the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "introduction to shaders" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " page." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 15, - "name": "createFilterShader" - }, - { - "title": "param", - "description": "source code for the fragment shader", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "fragSrc" - }, - { - "title": "returns", - "description": "a shader object created from the provided\n fragment shader.", - "lineNumber": 17, - "type": { - "type": "NameExpression", - "name": "p5.Shader" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 19 - } - ], - "loc": { - "start": { - "line": 202, - "column": 0, - "index": 5481 - }, - "end": { - "line": 278, - "column": 3, - "index": 8162 - } - }, - "context": { - "loc": { - "start": { - "line": 279, - "column": 0, - "index": 8163 - }, - "end": { - "line": 329, - "column": 2, - "index": 9782 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/material.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fragSrc", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "source code for the fragment shader" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "a shader object created from the provided\nfragment shader." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Shader" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createFilterShader", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createFilterShader", - "kind": "function" - } - ], - "namespace": "createFilterShader" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Shader" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object to\nbe used to render subsequent shapes." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createShader example" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Custom shaders can be created using the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createShader()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " and\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadShader()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " functions." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Use " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "resetShader()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to\nrestore the default shaders." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Additional Information:\nThe shader will be used for:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Fills when a texture is enabled if it includes a uniform " - }, - { - "type": "inlineCode", - "value": "sampler2D" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Fills when lights are enabled if it includes the attribute " - }, - { - "type": "inlineCode", - "value": "aNormal" - }, - { - "type": "text", - "value": ", or if it has any of the following uniforms: " - }, - { - "type": "inlineCode", - "value": "uUseLighting" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "uAmbientLightCount" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "uDirectionalLightCount" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "uPointLightCount" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "uAmbientColor" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "uDirectionalDiffuseColors" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "uDirectionalSpecularColors" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "uPointLightLocation" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "uPointLightDiffuseColors" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "uPointLightSpecularColors" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "inlineCode", - "value": "uLightingDirection" - }, - { - "type": "text", - "value": ", or " - }, - { - "type": "inlineCode", - "value": "uSpecular" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Fills whenever there are no lights or textures." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Strokes if it includes the uniform " - }, - { - "type": "inlineCode", - "value": "uStrokeWeight" - }, - { - "type": "text", - "value": ".\nNote: This behavior is considered experimental, and changes are planned in future releases." - } - ] - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note, shaders can only be used in WEBGL mode." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 24, - "name": "shader" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 25 - }, - { - "title": "param", - "description": "the p5.Shader object\nto use for rendering shapes.", - "lineNumber": 26, - "type": { - "type": "NameExpression", - "name": "p5.Shader" - }, - "name": "s" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 29 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 90 - } - ], - "loc": { - "start": { - "line": 331, - "column": 0, - "index": 9784 - }, - "end": { - "line": 423, - "column": 3, - "index": 13337 - } - }, - "context": { - "loc": { - "start": { - "line": 424, - "column": 0, - "index": 13338 - }, - "end": { - "line": 438, - "column": 2, - "index": 13675 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/material.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "s", - "lineNumber": 26, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Shader" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object\nto use for rendering shapes." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Shader" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "shader", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "shader", - "kind": "function" - } - ], - "namespace": "shader" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Restores the default shaders. Code that runs after resetShader()\nwill not be affected by the shader previously set by\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "shader()" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "resetShader" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 6 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 80 - } - ], - "loc": { - "start": { - "line": 440, - "column": 0, - "index": 13677 - }, - "end": { - "line": 523, - "column": 3, - "index": 15929 - } - }, - "context": { - "loc": { - "start": { - "line": 524, - "column": 0, - "index": 15930 - }, - "end": { - "line": 527, - "column": 2, - "index": 16062 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/material.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "resetShader", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "resetShader", - "kind": "function" - } - ], - "namespace": "resetShader" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the texture that will be used to render subsequent shapes." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A texture is like a \"skin\" that wraps around a 3D geometry. Currently\nsupported textures are images, video, and offscreen renders." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "To texture a geometry created with " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "beginShape()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\nyou will need to specify uv coordinates in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "vertex()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note, texture() can only be used in WEBGL mode." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "You can view more materials in this\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "example" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 14, - "name": "texture" - }, - { - "title": "param", - "description": "image to use as texture", - "lineNumber": 15, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Image" - }, - { - "type": "NameExpression", - "name": "p5.MediaElement" - }, - { - "type": "NameExpression", - "name": "p5.Graphics" - }, - { - "type": "NameExpression", - "name": "p5.Texture" - }, - { - "type": "NameExpression", - "name": "p5.Framebuffer" - }, - { - "type": "NameExpression", - "name": "p5.FramebufferTexture" - } - ] - }, - "name": "tex" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 16 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 17 - }, - { - "title": "alt", - "description": "spinning cube with a texture from an image", - "lineNumber": 41 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 44 - }, - { - "title": "alt", - "description": "plane with a texture from an image created by createGraphics()", - "lineNumber": 68 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 71 - }, - { - "title": "alt", - "description": "rectangle with video as texture", - "lineNumber": 97 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 100 - }, - { - "title": "alt", - "description": "quad with a texture, mapped using normalized coordinates", - "lineNumber": 127 - } - ], - "loc": { - "start": { - "line": 529, - "column": 0, - "index": 16064 - }, - "end": { - "line": 658, - "column": 3, - "index": 18960 - } - }, - "context": { - "loc": { - "start": { - "line": 659, - "column": 0, - "index": 18961 - }, - "end": { - "line": 672, - "column": 2, - "index": 19324 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/material.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - }, - { - "description": "
\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
" - }, - { - "description": "
\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
" - }, - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "tex", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "image to use as texture" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Image" - }, - { - "type": "NameExpression", - "name": "p5.MediaElement" - }, - { - "type": "NameExpression", - "name": "p5.Graphics" - }, - { - "type": "NameExpression", - "name": "p5.Texture" - }, - { - "type": "NameExpression", - "name": "p5.Framebuffer" - }, - { - "type": "NameExpression", - "name": "p5.FramebufferTexture" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "texture", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "texture", - "kind": "function" - } - ], - "namespace": "texture" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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)." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 8, - "name": "textureMode" - }, - { - "title": "param", - "description": "either IMAGE or NORMAL", - "lineNumber": 9, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "IMAGE" - }, - { - "type": "NameExpression", - "name": "NORMAL" - } - ] - }, - "name": "mode" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 10 - }, - { - "title": "alt", - "description": "quad with a texture, mapped using normalized coordinates", - "lineNumber": 36 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 39 - }, - { - "title": "alt", - "description": "quad with a texture, mapped using image coordinates", - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 674, - "column": 0, - "index": 19326 - }, - "end": { - "line": 741, - "column": 3, - "index": 21004 - } - }, - "context": { - "loc": { - "start": { - "line": 742, - "column": 0, - "index": 21005 - }, - "end": { - "line": 750, - "column": 2, - "index": 21269 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/material.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - }, - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "mode", - "lineNumber": 9, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either IMAGE or NORMAL" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "IMAGE" - }, - { - "type": "NameExpression", - "name": "NORMAL" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "textureMode", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "textureMode", - "kind": "function" - } - ], - "namespace": "textureMode" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "REPEAT & MIRROR are only available if the texture\nis a power of two size (128, 256, 512, 1024, etc.)." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This method will affect all textures in your sketch until a subsequent\ntextureWrap() call is made." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If only one argument is provided, it will be applied to both the\nhorizontal and vertical axes." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 17, - "name": "textureWrap" - }, - { - "title": "param", - "description": "either CLAMP, REPEAT, or MIRROR", - "lineNumber": 18, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "CLAMP" - }, - { - "type": "NameExpression", - "name": "REPEAT" - }, - { - "type": "NameExpression", - "name": "MIRROR" - } - ] - }, - "name": "wrapX" - }, - { - "title": "param", - "description": "either CLAMP, REPEAT, or MIRROR", - "lineNumber": 19, - "type": { - "type": "OptionalType", - "expression": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "CLAMP" - }, - { - "type": "NameExpression", - "name": "REPEAT" - }, - { - "type": "NameExpression", - "name": "MIRROR" - } - ] - } - }, - "name": "wrapY", - "default": "wrapX" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 20 - }, - { - "title": "alt", - "description": "an image of the rocky mountains repeated in mirrored tiles", - "lineNumber": 60 - } - ], - "loc": { - "start": { - "line": 752, - "column": 0, - "index": 21271 - }, - "end": { - "line": 814, - "column": 3, - "index": 23017 - } - }, - "context": { - "loc": { - "start": { - "line": 815, - "column": 0, - "index": 23018 - }, - "end": { - "line": 822, - "column": 2, - "index": 23263 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/material.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "wrapX", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either CLAMP, REPEAT, or MIRROR" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "CLAMP" - }, - { - "type": "NameExpression", - "name": "REPEAT" - }, - { - "type": "NameExpression", - "name": "MIRROR" - } - ] - } - }, - { - "title": "param", - "name": "wrapY", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "either CLAMP, REPEAT, or MIRROR" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "CLAMP" - }, - { - "type": "NameExpression", - "name": "REPEAT" - }, - { - "type": "NameExpression", - "name": "MIRROR" - } - ] - }, - "default": "wrapX" - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "textureWrap", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "textureWrap", - "kind": "function" - } - ], - "namespace": "textureWrap" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the current material as a normal material." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A normal material is not affected by light. It is often used as\na placeholder material when debugging." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Surfaces facing the X-axis become red, those facing the Y-axis\nbecome green, and those facing the Z-axis become blue." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "You can view more materials in this\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "example" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 12, - "name": "normalMaterial" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 13 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 14 - }, - { - "title": "alt", - "description": "Sphere with normal material", - "lineNumber": 29 - } - ], - "loc": { - "start": { - "line": 824, - "column": 0, - "index": 23265 - }, - "end": { - "line": 855, - "column": 3, - "index": 24008 - } - }, - "context": { - "loc": { - "start": { - "line": 856, - "column": 0, - "index": 24009 - }, - "end": { - "line": 867, - "column": 2, - "index": 24458 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/material.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "normalMaterial", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "normalMaterial", - "kind": "function" - } - ], - "namespace": "normalMaterial" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the ambient color of the material." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The ambientMaterial() color represents the components\nof the " - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "ambientLight()" - } - ] - }, - { - "type": "text", - "value": " color that the object reflects." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "You can view more materials in this\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "example" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 18, - "name": "ambientMaterial" - }, - { - "title": "param", - "description": "red or hue value relative to the current\n color range", - "lineNumber": 19, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v1" - }, - { - "title": "param", - "description": "green or saturation value relative to the\n current color range", - "lineNumber": 21, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v2" - }, - { - "title": "param", - "description": "blue or brightness value relative to the\n current color range", - "lineNumber": 23, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v3" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 25 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 26 - }, - { - "title": "alt", - "description": "sphere reflecting red, blue, and green light", - "lineNumber": 42 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 45 - }, - { - "title": "alt", - "description": "box reflecting only red and blue light", - "lineNumber": 62 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 65 - }, - { - "title": "alt", - "description": "box reflecting no light", - "lineNumber": 82 - } - ], - "loc": { - "start": { - "line": 869, - "column": 0, - "index": 24460 - }, - "end": { - "line": 953, - "column": 3, - "index": 26972 - } - }, - "context": { - "loc": { - "start": { - "line": 969, - "column": 0, - "index": 27323 - }, - "end": { - "line": 980, - "column": 2, - "index": 27771 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/material.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - }, - { - "description": "
\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
" - }, - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "red or hue value relative to the current\ncolor range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 21, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "green or saturation value relative to the\ncurrent color range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v3", - "lineNumber": 23, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "blue or brightness value relative to the\ncurrent color range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "ambientMaterial", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ambientMaterial", - "kind": "function" - } - ], - "namespace": "ambientMaterial" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "ambientMaterial" - }, - { - "title": "param", - "description": "number specifying value between\n white and black", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "gray" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 955, - "column": 0, - "index": 26974 - }, - "end": { - "line": 960, - "column": 3, - "index": 27123 - } - }, - "context": { - "loc": { - "start": { - "line": 969, - "column": 0, - "index": 27323 - }, - "end": { - "line": 980, - "column": 2, - "index": 27771 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/material.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "gray", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number specifying value between\nwhite and black" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "ambientMaterial", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ambientMaterial", - "kind": "function" - } - ], - "namespace": "ambientMaterial" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "ambientMaterial" - }, - { - "title": "param", - "description": "color as a p5.Color,\n as an array, or as a CSS string", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "color" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 962, - "column": 0, - "index": 27125 - }, - "end": { - "line": 968, - "column": 3, - "index": 27322 - } - }, - "context": { - "loc": { - "start": { - "line": 969, - "column": 0, - "index": 27323 - }, - "end": { - "line": 980, - "column": 2, - "index": 27771 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/material.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "color as a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\nas an array, or as a CSS string" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "ambientMaterial", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ambientMaterial", - "kind": "function" - } - ], - "namespace": "ambientMaterial" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the emissive color of the material." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "An emissive material will display the emissive color at\nfull strength regardless of lighting. This can give the\nappearance that the object is glowing." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note, \"emissive\" is a misnomer in the sense that the material\ndoes not actually emit light that will affect surrounding objects." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "You can view more materials in this\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "example" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 13, - "name": "emissiveMaterial" - }, - { - "title": "param", - "description": "red or hue value relative to the current\n color range", - "lineNumber": 14, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v1" - }, - { - "title": "param", - "description": "green or saturation value relative to the\n current color range", - "lineNumber": 16, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v2" - }, - { - "title": "param", - "description": "blue or brightness value relative to the\n current color range", - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v3" - }, - { - "title": "param", - "description": "alpha value relative to current color\n range (default is 0-255)", - "lineNumber": 20, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "alpha" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 22 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 23 - }, - { - "title": "alt", - "description": "sphere with green emissive material", - "lineNumber": 40 - } - ], - "loc": { - "start": { - "line": 982, - "column": 0, - "index": 27773 - }, - "end": { - "line": 1024, - "column": 3, - "index": 29114 - } - }, - "context": { - "loc": { - "start": { - "line": 1040, - "column": 0, - "index": 29467 - }, - "end": { - "line": 1051, - "column": 2, - "index": 29881 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/material.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 14, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "red or hue value relative to the current\ncolor range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "green or saturation value relative to the\ncurrent color range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v3", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "blue or brightness value relative to the\ncurrent color range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "alpha", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "alpha value relative to current color\nrange (default is 0-255)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "emissiveMaterial", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "emissiveMaterial", - "kind": "function" - } - ], - "namespace": "emissiveMaterial" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "emissiveMaterial" - }, - { - "title": "param", - "description": "number specifying value between\n white and black", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "gray" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 4 - } - ], - "loc": { - "start": { - "line": 1026, - "column": 0, - "index": 29116 - }, - "end": { - "line": 1031, - "column": 3, - "index": 29266 - } - }, - "context": { - "loc": { - "start": { - "line": 1040, - "column": 0, - "index": 29467 - }, - "end": { - "line": 1051, - "column": 2, - "index": 29881 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/material.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "gray", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number specifying value between\nwhite and black" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "emissiveMaterial", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "emissiveMaterial", - "kind": "function" - } - ], - "namespace": "emissiveMaterial" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "emissiveMaterial" - }, - { - "title": "param", - "description": "color as a p5.Color,\n as an array, or as a CSS string", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "color" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 1033, - "column": 0, - "index": 29268 - }, - "end": { - "line": 1039, - "column": 3, - "index": 29466 - } - }, - "context": { - "loc": { - "start": { - "line": 1040, - "column": 0, - "index": 29467 - }, - "end": { - "line": 1051, - "column": 2, - "index": 29881 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/material.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "color as a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\nas an array, or as a CSS string" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "emissiveMaterial", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "emissiveMaterial", - "kind": "function" - } - ], - "namespace": "emissiveMaterial" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the specular color of the material." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A specular material is reflective (shiny). The shininess can be\ncontrolled by the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "shininess()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " function." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Like " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "ambientMaterial()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\nthe specularMaterial() color is the color the object will reflect\nunder " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "ambientLight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ".\nHowever unlike ambientMaterial(), for all other types of lights\n(" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "directionalLight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "pointLight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "spotLight()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "),\na specular material will reflect the " - }, - { - "type": "strong", - "children": [ - { - "type": "text", - "value": "color of the light source" - } - ] - }, - { - "type": "text", - "value": ".\nThis is what gives it its \"shiny\" appearance." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "You can view more materials in this\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "example" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 19, - "name": "specularMaterial" - }, - { - "title": "param", - "description": "number specifying value between white and black.", - "lineNumber": 20, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "gray" - }, - { - "title": "param", - "description": "alpha value relative to current color range\n (default is 0-255)", - "lineNumber": 21, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "alpha" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 23 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 25 - }, - { - "title": "alt", - "description": "torus with specular material", - "lineNumber": 50 - } - ], - "loc": { - "start": { - "line": 1053, - "column": 0, - "index": 29883 - }, - "end": { - "line": 1105, - "column": 3, - "index": 31518 - } - }, - "context": { - "loc": { - "start": { - "line": 1126, - "column": 0, - "index": 32191 - }, - "end": { - "line": 1137, - "column": 2, - "index": 32609 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/material.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "gray", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number specifying value between white and black." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "alpha", - "lineNumber": 21, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "alpha value relative to current color range\n(default is 0-255)" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "specularMaterial", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "specularMaterial", - "kind": "function" - } - ], - "namespace": "specularMaterial" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "specularMaterial" - }, - { - "title": "param", - "description": "red or hue value relative to\n the current color range", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v1" - }, - { - "title": "param", - "description": "green or saturation value\n relative to the current color range", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v2" - }, - { - "title": "param", - "description": "blue or brightness value\n relative to the current color range", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v3" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "alpha" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 1107, - "column": 0, - "index": 31520 - }, - "end": { - "line": 1117, - "column": 3, - "index": 31990 - } - }, - "context": { - "loc": { - "start": { - "line": 1126, - "column": 0, - "index": 32191 - }, - "end": { - "line": 1137, - "column": 2, - "index": 32609 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/material.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v1", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "red or hue value relative to\nthe current color range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v2", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "green or saturation value\nrelative to the current color range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "v3", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "blue or brightness value\nrelative to the current color range" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "alpha", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "specularMaterial", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "specularMaterial", - "kind": "function" - } - ], - "namespace": "specularMaterial" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "specularMaterial" - }, - { - "title": "param", - "description": "color as a p5.Color,\n as an array, or as a CSS string", - "lineNumber": 2, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - }, - "name": "color" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 5 - } - ], - "loc": { - "start": { - "line": 1119, - "column": 0, - "index": 31992 - }, - "end": { - "line": 1125, - "column": 3, - "index": 32190 - } - }, - "context": { - "loc": { - "start": { - "line": 1126, - "column": 0, - "index": 32191 - }, - "end": { - "line": 1137, - "column": 2, - "index": 32609 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/material.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "color", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "color as a " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Color" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\nas an array, or as a CSS string" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Color" - }, - { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - { - "type": "NameExpression", - "name": "String" - } - ] - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "specularMaterial", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "specularMaterial", - "kind": "function" - } - ], - "namespace": "specularMaterial" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the amount of gloss (\"shininess\") of a\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "specularMaterial()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The default and minimum value is 1." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 6, - "name": "shininess" - }, - { - "title": "param", - "description": "degree of shininess", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "shine" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 8 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 9 - }, - { - "title": "alt", - "description": "two spheres, one more shiny than the other", - "lineNumber": 33 - } - ], - "loc": { - "start": { - "line": 1139, - "column": 0, - "index": 32611 - }, - "end": { - "line": 1174, - "column": 3, - "index": 33449 - } - }, - "context": { - "loc": { - "start": { - "line": 1175, - "column": 0, - "index": 33450 - }, - "end": { - "line": 1184, - "column": 2, - "index": 33671 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/material.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "shine", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "degree of shininess" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "shininess", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "shininess", - "kind": "function" - } - ], - "namespace": "shininess" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the metalness property of a material used in 3D rendering." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The default and minimum value is 0, indicating a non-metallic appearance." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 16, - "name": "metalness" - }, - { - "title": "param", - "description": "The degree of metalness.", - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "metallic" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 19 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 55 - } - ], - "loc": { - "start": { - "line": 1186, - "column": 0, - "index": 33673 - }, - "end": { - "line": 1270, - "column": 3, - "index": 36174 - } - }, - "context": { - "loc": { - "start": { - "line": 1271, - "column": 0, - "index": 36175 - }, - "end": { - "line": 1276, - "column": 2, - "index": 36363 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/material.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - }, - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "metallic", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The degree of metalness." - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "metalness", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "metalness", - "kind": "function" - } - ], - "namespace": "metalness" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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)." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "See this " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "example" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nto view the position of your camera." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If no parameters are given, the following default is used:\ncamera(0, 0, 800, 0, 0, 0, 0, 1, 0)" - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 17, - "name": "camera" - }, - { - "title": "for", - "description": "p5", - "lineNumber": 18 - }, - { - "title": "param", - "description": "camera position value on x axis", - "lineNumber": 19, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "x" - }, - { - "title": "param", - "description": "camera position value on y axis", - "lineNumber": 20, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "y" - }, - { - "title": "param", - "description": "camera position value on z axis", - "lineNumber": 21, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "z" - }, - { - "title": "param", - "description": "x coordinate representing center of the sketch", - "lineNumber": 22, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "centerX" - }, - { - "title": "param", - "description": "y coordinate representing center of the sketch", - "lineNumber": 23, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "centerY" - }, - { - "title": "param", - "description": "z coordinate representing center of the sketch", - "lineNumber": 24, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "centerZ" - }, - { - "title": "param", - "description": "x component of direction 'up' from camera", - "lineNumber": 25, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "upX" - }, - { - "title": "param", - "description": "y component of direction 'up' from camera", - "lineNumber": 26, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "upY" - }, - { - "title": "param", - "description": "z component of direction 'up' from camera", - "lineNumber": 27, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "upZ" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 28 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 29 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 46 - }, - { - "title": "alt", - "description": "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.", - "lineNumber": 95 - } - ], - "loc": { - "start": { - "line": 13, - "column": 0, - "index": 281 - }, - "end": { - "line": 112, - "column": 3, - "index": 3809 - } - }, - "context": { - "loc": { - "start": { - "line": 113, - "column": 0, - "index": 3810 - }, - "end": { - "line": 118, - "column": 2, - "index": 3985 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - }, - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "x", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "camera position value on x axis" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "y", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "camera position value on y axis" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "z", - "lineNumber": 21, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "camera position value on z axis" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "centerX", - "lineNumber": 22, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x coordinate representing center of the sketch" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "centerY", - "lineNumber": 23, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y coordinate representing center of the sketch" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "centerZ", - "lineNumber": 24, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z coordinate representing center of the sketch" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "upX", - "lineNumber": 25, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "x component of direction 'up' from camera" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "upY", - "lineNumber": 26, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "y component of direction 'up' from camera" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "upZ", - "lineNumber": 27, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "z component of direction 'up' from camera" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "camera", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "camera", - "kind": "function" - } - ], - "namespace": "camera" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If no parameters are given, the default values are used as:" - } - ] - }, - { - "type": "list", - "ordered": false, - "start": null, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "fov" - }, - { - "type": "text", - "value": " : 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." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "aspect" - }, - { - "type": "text", - "value": " : The default aspect ratio is the ratio of renderer's width to renderer's height." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "near" - }, - { - "type": "text", - "value": " : The default value for the near clipping plane is 80, which is 0.1 times the default distance from the camera to its subject." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "inlineCode", - "value": "far" - }, - { - "type": "text", - "value": " : The default value for the far clipping plane is 8000, which is 10 times the default distance from the camera to its subject." - } - ] - } - ] - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If you prefer a fixed field of view, follow these steps:" - } - ] - }, - { - "type": "list", - "ordered": true, - "start": 1, - "spread": false, - "children": [ - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Choose your desired field of view angle (" - }, - { - "type": "inlineCode", - "value": "fovy" - }, - { - "type": "text", - "value": "). This is how wide the camera can see." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "To ensure that you can see the entire width across horizontally and height across vertically, place the camera a distance of " - }, - { - "type": "inlineCode", - "value": "(height / 2) / tan(fovy / 2)" - }, - { - "type": "text", - "value": " back from its subject." - } - ] - } - ] - }, - { - "type": "listItem", - "spread": false, - "checked": null, - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Call perspective with the chosen field of view, canvas aspect ratio, and near/far values:\n" - }, - { - "type": "inlineCode", - "value": "perspective(fovy, width / height, cameraDistance / 10, cameraDistance * 10);" - } - ] - } - ] - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 24, - "name": "perspective" - }, - { - "title": "for", - "description": "p5", - "lineNumber": 25 - }, - { - "title": "param", - "description": "camera frustum vertical field of view,\n from bottom to top of view, in angleMode units", - "lineNumber": 26, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "fovy" - }, - { - "title": "param", - "description": "camera frustum aspect ratio", - "lineNumber": 28, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "aspect" - }, - { - "title": "param", - "description": "frustum near plane length", - "lineNumber": 29, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "near" - }, - { - "title": "param", - "description": "frustum far plane length", - "lineNumber": 30, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "far" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 31 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 32 - }, - { - "title": "alt", - "description": "two colored 3D boxes move back and forth, rotating as mouse is dragged.", - "lineNumber": 65 - } - ], - "loc": { - "start": { - "line": 120, - "column": 0, - "index": 3987 - }, - "end": { - "line": 187, - "column": 3, - "index": 6833 - } - }, - "context": { - "loc": { - "start": { - "line": 188, - "column": 0, - "index": 6834 - }, - "end": { - "line": 193, - "column": 2, - "index": 7029 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "fovy", - "lineNumber": 26, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "camera frustum vertical field of view,\nfrom bottom to top of view, in " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "angleMode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " units" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "aspect", - "lineNumber": 28, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "camera frustum aspect ratio" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "near", - "lineNumber": 29, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "frustum near plane length" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "far", - "lineNumber": 30, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "frustum far plane length" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "perspective", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "perspective", - "kind": "function" - } - ], - "namespace": "perspective" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If no parameters are given, the following default is used:\northo(-width/2, width/2, -height/2, height/2, 0, max(width, height))." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 13, - "name": "ortho" - }, - { - "title": "for", - "description": "p5", - "lineNumber": 14 - }, - { - "title": "param", - "description": "camera frustum left plane", - "lineNumber": 15, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "left" - }, - { - "title": "param", - "description": "camera frustum right plane", - "lineNumber": 16, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "right" - }, - { - "title": "param", - "description": "camera frustum bottom plane", - "lineNumber": 17, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "bottom" - }, - { - "title": "param", - "description": "camera frustum top plane", - "lineNumber": 18, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "top" - }, - { - "title": "param", - "description": "camera frustum near plane", - "lineNumber": 19, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "near" - }, - { - "title": "param", - "description": "camera frustum far plane", - "lineNumber": 20, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "far" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 21 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 22 - }, - { - "title": "alt", - "description": "two 3D boxes move back and forth along same plane, rotating as mouse is dragged.", - "lineNumber": 54 - } - ], - "loc": { - "start": { - "line": 195, - "column": 0, - "index": 7031 - }, - "end": { - "line": 251, - "column": 3, - "index": 8910 - } - }, - "context": { - "loc": { - "start": { - "line": 252, - "column": 0, - "index": 8911 - }, - "end": { - "line": 257, - "column": 2, - "index": 9082 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "left", - "lineNumber": 15, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "camera frustum left plane" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "right", - "lineNumber": 16, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "camera frustum right plane" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "bottom", - "lineNumber": 17, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "camera frustum bottom plane" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "top", - "lineNumber": 18, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "camera frustum top plane" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "near", - "lineNumber": 19, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "camera frustum near plane" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "far", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "camera frustum far plane" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "ortho", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "ortho", - "kind": "function" - } - ], - "namespace": "ortho" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the frustum of the current camera as defined by\nthe parameters." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Setting the frustum changes the perspective of the scene being rendered.\nThis can be achieved more simply in many cases by using\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "perspective()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 18, - "name": "frustum" - }, - { - "title": "for", - "description": "p5", - "lineNumber": 19 - }, - { - "title": "param", - "description": "camera frustum left plane", - "lineNumber": 20, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "left" - }, - { - "title": "param", - "description": "camera frustum right plane", - "lineNumber": 21, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "right" - }, - { - "title": "param", - "description": "camera frustum bottom plane", - "lineNumber": 22, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "bottom" - }, - { - "title": "param", - "description": "camera frustum top plane", - "lineNumber": 23, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "top" - }, - { - "title": "param", - "description": "camera frustum near plane", - "lineNumber": 24, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "near" - }, - { - "title": "param", - "description": "camera frustum far plane", - "lineNumber": 25, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - }, - "name": "far" - }, - { - "title": "chainable", - "description": null, - "lineNumber": 26 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 27 - }, - { - "title": "alt", - "description": "two 3D boxes move back and forth along same plane, rotating as mouse is dragged.", - "lineNumber": 58 - } - ], - "loc": { - "start": { - "line": 259, - "column": 0, - "index": 9084 - }, - "end": { - "line": 319, - "column": 3, - "index": 11023 - } - }, - "context": { - "loc": { - "start": { - "line": 320, - "column": 0, - "index": 11024 - }, - "end": { - "line": 325, - "column": 2, - "index": 11203 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "left", - "lineNumber": 20, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "camera frustum left plane" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "right", - "lineNumber": 21, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "camera frustum right plane" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "bottom", - "lineNumber": 22, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "camera frustum bottom plane" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "top", - "lineNumber": 23, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "camera frustum top plane" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "near", - "lineNumber": 24, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "camera frustum near plane" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - }, - { - "title": "param", - "name": "far", - "lineNumber": 25, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "camera frustum far plane" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Number" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "frustum", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "frustum", - "kind": "function" - } - ], - "namespace": "frustum" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Creates a new " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Camera" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " object and sets it\nas the current (active) camera." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The new camera is initialized with a default position\n(see " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "camera()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ")\nand a default perspective projection\n(see " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "perspective()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ").\nIts properties can be controlled with the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "p5.Camera" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nmethods." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note: Every 3D sketch starts with a default camera initialized.\nThis camera can be controlled with the global methods\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "camera()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "perspective()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "ortho()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ",\nand " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "frustum()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " if it is the only camera\nin the scene." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 17, - "name": "createCamera" - }, - { - "title": "return", - "description": "The newly created camera object.", - "lineNumber": 18, - "type": { - "type": "NameExpression", - "name": "p5.Camera" - } - }, - { - "title": "for", - "description": "p5", - "lineNumber": 19 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 20 - }, - { - "title": "alt", - "description": "An example that creates a camera and moves it around the box.", - "lineNumber": 53 - } - ], - "loc": { - "start": { - "line": 331, - "column": 0, - "index": 11381 - }, - "end": { - "line": 386, - "column": 3, - "index": 13192 - } - }, - "context": { - "loc": { - "start": { - "line": 387, - "column": 0, - "index": 13193 - }, - "end": { - "line": 399, - "column": 2, - "index": 13554 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The newly created camera object." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Camera" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "createCamera", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "createCamera", - "kind": "function" - } - ], - "namespace": "createCamera" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "This class describes a camera for use in p5's\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nWebGL mode" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ". It contains camera position, orientation, and projection\ninformation necessary for rendering a 3D scene." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "New p5.Camera objects can be made through the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCamera()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " 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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setCamera()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "move()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " method,\nfor instance, moves the camera along its own axes, whereas the\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setPosition()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nmethod sets the camera's position in world-space." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The camera object properties\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nwhich describes camera position, orientation, and projection\nare also accessible via the camera object generated using\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "createCamera()" - }, - { - "type": "html", - "value": "" - } - ] - } - ] - }, - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 30, - "type": null, - "name": "p5.Camera" - }, - { - "title": "param", - "description": "instance of WebGL renderer", - "lineNumber": 31, - "type": { - "type": "NameExpression", - "name": "rendererGL" - }, - "name": "rendererGL" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 32 - }, - { - "title": "alt", - "description": "camera view pans left and right across a series of rotating 3D boxes.", - "lineNumber": 81 - } - ], - "loc": { - "start": { - "line": 401, - "column": 0, - "index": 13556 - }, - "end": { - "line": 484, - "column": 3, - "index": 16362 - } - }, - "context": { - "loc": { - "start": { - "line": 485, - "column": 0, - "index": 16363 - }, - "end": { - "line": 2203, - "column": 2, - "index": 66773 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "rendererGL", - "lineNumber": 31, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "instance of WebGL renderer" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "rendererGL" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "class", - "name": "p5.Camera", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.Camera", - "kind": "class" - } - ], - "namespace": "p5.Camera" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Sets the current (active) camera of a 3D sketch.\nAllows for switching between multiple cameras." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 3, - "name": "setCamera" - }, - { - "title": "param", - "description": "p5.Camera object", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "p5.Camera" - }, - "name": "cam" - }, - { - "title": "for", - "description": "p5", - "lineNumber": 5 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 6 - }, - { - "title": "alt", - "description": "Canvas switches between two camera views, each showing a series of spinning\n3D boxes.", - "lineNumber": 73 - } - ], - "loc": { - "start": { - "line": 2205, - "column": 0, - "index": 66775 - }, - "end": { - "line": 2281, - "column": 3, - "index": 68515 - } - }, - "context": { - "loc": { - "start": { - "line": 2282, - "column": 0, - "index": 68516 - }, - "end": { - "line": 2287, - "column": 2, - "index": 68717 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Camera.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "cam", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "p5.Camera object" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.Camera" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "setCamera", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setCamera", - "kind": "function" - } - ], - "namespace": "setCamera" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 6, - "type": null, - "name": "p5.Framebuffer" - }, - { - "title": "param", - "description": "A p5 global instance or p5.Graphics", - "lineNumber": 7, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Graphics" - }, - { - "type": "NameExpression", - "name": "p5" - } - ] - }, - "name": "target" - }, - { - "title": "param", - "description": "A settings object", - "lineNumber": 8, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - }, - "name": "settings" - } - ], - "loc": { - "start": { - "line": 70, - "column": 0, - "index": 1977 - }, - "end": { - "line": 79, - "column": 3, - "index": 2404 - } - }, - "context": { - "loc": { - "start": { - "line": 80, - "column": 0, - "index": 2405 - }, - "end": { - "line": 1238, - "column": 2, - "index": 37823 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Framebuffer.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "target", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A p5 global instance or p5.Graphics" - } - ] - } - ] - }, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.Graphics" - }, - { - "type": "NameExpression", - "name": "p5" - } - ] - } - }, - { - "title": "param", - "name": "settings", - "lineNumber": 8, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A settings object" - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Object" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "class", - "name": "p5.Framebuffer", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.Framebuffer", - "kind": "class" - } - ], - "namespace": "p5.Framebuffer" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A texture with the color information of the framebuffer. Pass this (or the\nframebuffer itself) to " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "texture()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to draw it to\nthe canvas, or pass it to a shader with\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setUniform()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to read its data." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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\n" - }, - { - "type": "inlineCode", - "value": "plane(framebuffer.width, -framebuffer.height)" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "p5.FramebufferTexture" - }, - "name": "color" - }, - { - "title": "for", - "description": "p5.Framebuffer", - "lineNumber": 12 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 14 - }, - { - "title": "alt", - "description": "A red, green, and blue sphere in the middle of the canvas", - "lineNumber": 38 - } - ], - "loc": { - "start": { - "line": 1240, - "column": 0, - "index": 37825 - }, - "end": { - "line": 1280, - "column": 3, - "index": 38977 - } - }, - "context": { - "loc": { - "start": { - "line": 1379, - "column": 0, - "index": 41941 - }, - "end": { - "line": 1379, - "column": 30, - "index": 41971 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Framebuffer.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "color", - "lineNumber": 11, - "type": { - "type": "NameExpression", - "name": "p5.FramebufferTexture" - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "p5.Framebuffer", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.Framebuffer" - } - ], - "namespace": "p5.Framebuffer" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A texture with the depth information of the framebuffer. If the framebuffer\nwas created with " - }, - { - "type": "inlineCode", - "value": "{ depth: false }" - }, - { - "type": "text", - "value": " in its settings, then this property will\nbe undefined. Pass this to " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "texture()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to draw it to\nthe canvas, or pass it to a shader with\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "setUniform()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " to read its data." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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\n" - }, - { - "type": "inlineCode", - "value": "plane(framebuffer.width, -framebuffer.height)" - }, - { - "type": "text", - "value": "." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 12, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.FramebufferTexture" - }, - { - "type": "UndefinedLiteral" - } - ] - }, - "name": "depth" - }, - { - "title": "for", - "description": "p5.Framebuffer", - "lineNumber": 13 - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 15 - }, - { - "title": "alt", - "description": "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", - "lineNumber": 73 - } - ], - "loc": { - "start": { - "line": 1282, - "column": 0, - "index": 38979 - }, - "end": { - "line": 1359, - "column": 3, - "index": 41190 - } - }, - "context": { - "loc": { - "start": { - "line": 1379, - "column": 0, - "index": 41941 - }, - "end": { - "line": 1379, - "column": 30, - "index": 41971 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Framebuffer.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "depth", - "lineNumber": 12, - "type": { - "type": "UnionType", - "elements": [ - { - "type": "NameExpression", - "name": "p5.FramebufferTexture" - }, - { - "type": "UndefinedLiteral" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "p5.Framebuffer", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.Framebuffer" - } - ], - "namespace": "p5.Framebuffer" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "A " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "Uint8ClampedArray" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\ncontaining the values for all the pixels in the Framebuffer." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Like the " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "main canvas pixels property" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": ", call\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "loadPixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": " before reading\nit, and call " - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "updatePixels()" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nafterwards to update its data." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note that updating pixels via this property will be slower than\n" - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "drawing to the framebuffer directly." - }, - { - "type": "html", - "value": "" - }, - { - "type": "text", - "value": "\nConsider using a shader instead of looping over pixels." - } - ] - } - ] - }, - "tags": [ - { - "title": "property", - "description": null, - "lineNumber": 14, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "pixels" - }, - { - "title": "for", - "description": "p5.Framebuffer", - "lineNumber": 15 - } - ], - "loc": { - "start": { - "line": 1361, - "column": 0, - "index": 41192 - }, - "end": { - "line": 1377, - "column": 3, - "index": 41939 - } - }, - "context": { - "loc": { - "start": { - "line": 1379, - "column": 0, - "index": 41941 - }, - "end": { - "line": 1379, - "column": 30, - "index": 41971 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Framebuffer.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [ - { - "title": "property", - "name": "pixels", - "lineNumber": 14, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - } - ], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "p5.Framebuffer", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.Framebuffer" - } - ], - "namespace": "p5.Framebuffer" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "p5 Geometry class" - } - ] - } - ] - }, - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 3, - "type": null, - "name": "p5.Geometry" - }, - { - "title": "param", - "description": "number of vertices along the x-axis.", - "lineNumber": 4, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailX" - }, - { - "title": "param", - "description": "number of vertices along the y-axis.", - "lineNumber": 5, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - }, - "name": "detailY" - }, - { - "title": "param", - "description": "function to call upon object instantiation.", - "lineNumber": 6, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - }, - "name": "callback" - } - ], - "loc": { - "start": { - "line": 13, - "column": 0, - "index": 259 - }, - "end": { - "line": 20, - "column": 3, - "index": 524 - } - }, - "context": { - "loc": { - "start": { - "line": 21, - "column": 0, - "index": 525 - }, - "end": { - "line": 858, - "column": 2, - "index": 24708 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Geometry.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "detailX", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of vertices along the x-axis." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - }, - { - "title": "param", - "name": "detailY", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "number of vertices along the y-axis." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "Integer" - } - } - }, - { - "title": "param", - "name": "callback", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "function to call upon object instantiation." - } - ] - } - ] - }, - "type": { - "type": "OptionalType", - "expression": { - "type": "NameExpression", - "name": "function" - } - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "class", - "name": "p5.Geometry", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.Geometry", - "kind": "class" - } - ], - "namespace": "p5.Geometry" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Flips the U texture coordinates of the model." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 2, - "name": "flipU" - }, - { - "title": "for", - "description": "p5.Geometry", - "lineNumber": 3 - }, - { - "title": "returns", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 142, - "column": 2, - "index": 4715 - }, - "end": { - "line": 204, - "column": 3, - "index": 5829 - } - }, - "context": { - "loc": { - "start": { - "line": 205, - "column": 2, - "index": 5832 - }, - "end": { - "line": 213, - "column": 3, - "index": 6002 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Geometry.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "flipU", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "flipU", - "kind": "function" - } - ], - "namespace": "flipU" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Flips the V texture coordinates of the model." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 2, - "name": "flipV" - }, - { - "title": "for", - "description": "p5.Geometry", - "lineNumber": 3 - }, - { - "title": "returns", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - } - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 7 - } - ], - "loc": { - "start": { - "line": 214, - "column": 2, - "index": 6005 - }, - "end": { - "line": 276, - "column": 3, - "index": 7119 - } - }, - "context": { - "loc": { - "start": { - "line": 277, - "column": 2, - "index": 7122 - }, - "end": { - "line": 285, - "column": 3, - "index": 7292 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Geometry.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "p5.Geometry" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "flipV", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "flipV", - "kind": "function" - } - ], - "namespace": "flipV" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "PRIVATE" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 925, - "column": 2, - "index": 27892 - }, - "end": { - "line": 927, - "column": 3, - "index": 27910 - } - }, - "context": { - "loc": { - "start": { - "line": 911, - "column": 2, - "index": 27485 - }, - "end": { - "line": 923, - "column": 3, - "index": 27888 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Matrix.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [], - "namespace": "" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Note that this will reinitialize the drawing context\nif called after the WebGL canvas is made." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "If an object is passed as the parameter, all attributes\nnot declared in the object will be set to defaults." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "The available attributes are:\n" - }, - { - "type": "html", - "value": "
" - }, - { - "type": "text", - "value": "\nalpha - indicates if the canvas contains an alpha buffer\ndefault is true" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "depth - indicates whether the drawing buffer has a depth buffer\nof at least 16 bits - default is true" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "stencil - indicates whether the drawing buffer has a stencil buffer\nof at least 8 bits" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "antialias - indicates whether or not to perform anti-aliasing\ndefault is false (true in Safari)" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "premultipliedAlpha - indicates that the page compositor will assume\nthe drawing buffer contains colors with pre-multiplied alpha\ndefault is true" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "perPixelLighting - if true, per-pixel lighting will be used in the\nlighting shader otherwise per-vertex lighting is used.\ndefault is true." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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 " - }, - { - "type": "inlineCode", - "value": "webglVersion" - }, - { - "type": "text", - "value": " property." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 43, - "name": "setAttributes" - }, - { - "title": "for", - "description": "p5", - "lineNumber": 44 - }, - { - "title": "param", - "description": "Name of attribute", - "lineNumber": 45, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "key" - }, - { - "title": "param", - "description": "New value of named attribute", - "lineNumber": 46, - "type": { - "type": "NameExpression", - "name": "Boolean" - }, - "name": "value" - }, - { - "title": "example", - "description": "
\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
", - "lineNumber": 47 - }, - { - "title": "alt", - "description": "a rotating cube with smoother edges", - "lineNumber": 142 - } - ], - "loc": { - "start": { - "line": 112, - "column": 0, - "index": 3720 - }, - "end": { - "line": 255, - "column": 3, - "index": 7519 - } - }, - "context": { - "loc": { - "start": { - "line": 261, - "column": 0, - "index": 7617 - }, - "end": { - "line": 311, - "column": 2, - "index": 9029 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [ - { - "description": "
\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
" - } - ], - "implements": [], - "params": [ - { - "title": "param", - "name": "key", - "lineNumber": 45, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Name of attribute" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "value", - "lineNumber": 46, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "New value of named attribute" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "setAttributes", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setAttributes", - "kind": "function" - } - ], - "namespace": "setAttributes" - }, - { - "description": "", - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 1, - "name": "setAttributes" - }, - { - "title": "for", - "description": "p5", - "lineNumber": 2 - }, - { - "title": "param", - "description": "object with key-value pairs", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Object" - }, - "name": "obj" - } - ], - "loc": { - "start": { - "line": 256, - "column": 0, - "index": 7520 - }, - "end": { - "line": 260, - "column": 3, - "index": 7616 - } - }, - "context": { - "loc": { - "start": { - "line": 261, - "column": 0, - "index": 7617 - }, - "end": { - "line": 311, - "column": 2, - "index": 9029 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "obj", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "object with key-value pairs" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "setAttributes", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setAttributes", - "kind": "function" - } - ], - "namespace": "setAttributes" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "model view, projection, & normal\nmatrices" - } - ] - } - ] - }, - "tags": [], - "loc": { - "start": { - "line": 528, - "column": 4, - "index": 16332 - }, - "end": { - "line": 531, - "column": 3, - "index": 16387 - } - }, - "context": { - "loc": { - "start": { - "line": 532, - "column": 4, - "index": 16392 - }, - "end": { - "line": 532, - "column": 37, - "index": 16425 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.RendererGL.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "name": "uMVMatrix", - "memberof": "RendererGL", - "scope": "instance", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "uMVMatrix", - "scope": "instance" - } - ], - "namespace": "#uMVMatrix" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Shader class for WEBGL Mode" - } - ] - } - ] - }, - "tags": [ - { - "title": "class", - "description": null, - "lineNumber": 2, - "type": null, - "name": "p5.Shader" - }, - { - "title": "param", - "description": "an instance of p5.RendererGL that\nwill provide the GL context for this new p5.Shader", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "p5.RendererGL" - }, - "name": "renderer" - }, - { - "title": "param", - "description": "source code for the vertex shader (as a string)", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "vertSrc" - }, - { - "title": "param", - "description": "source code for the fragment shader (as a string)", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "fragSrc" - } - ], - "loc": { - "start": { - "line": 11, - "column": 0, - "index": 150 - }, - "end": { - "line": 18, - "column": 3, - "index": 483 - } - }, - "context": { - "loc": { - "start": { - "line": 19, - "column": 0, - "index": 484 - }, - "end": { - "line": 657, - "column": 2, - "index": 19954 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Shader.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "renderer", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "an instance of p5.RendererGL that\nwill provide the GL context for this new p5.Shader" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "p5.RendererGL" - } - }, - { - "title": "param", - "name": "vertSrc", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "source code for the vertex shader (as a string)" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "fragSrc", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "source code for the fragment shader (as a string)" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "class", - "name": "p5.Shader", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "p5.Shader", - "kind": "class" - } - ], - "namespace": "p5.Shader" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "update" - } - ], - "loc": { - "start": { - "line": 194, - "column": 2, - "index": 7076 - }, - "end": { - "line": 200, - "column": 5, - "index": 7394 - } - }, - "context": { - "loc": { - "start": { - "line": 201, - "column": 2, - "index": 7397 - }, - "end": { - "line": 294, - "column": 3, - "index": 10729 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Texture.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "update", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "update", - "kind": "function" - } - ], - "namespace": "update" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Binds the texture to the appropriate GL target." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 2, - "name": "bindTexture" - } - ], - "loc": { - "start": { - "line": 296, - "column": 2, - "index": 10733 - }, - "end": { - "line": 299, - "column": 5, - "index": 10820 - } - }, - "context": { - "loc": { - "start": { - "line": 300, - "column": 2, - "index": 10823 - }, - "end": { - "line": 307, - "column": 3, - "index": 11036 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Texture.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "bindTexture", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "bindTexture", - "kind": "function" - } - ], - "namespace": "bindTexture" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Unbinds the texture from the appropriate GL target." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 2, - "name": "unbindTexture" - } - ], - "loc": { - "start": { - "line": 309, - "column": 2, - "index": 11040 - }, - "end": { - "line": 312, - "column": 5, - "index": 11133 - } - }, - "context": { - "loc": { - "start": { - "line": 313, - "column": 2, - "index": 11136 - }, - "end": { - "line": 317, - "column": 3, - "index": 11288 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Texture.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "unbindTexture", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "unbindTexture", - "kind": "function" - } - ], - "namespace": "unbindTexture" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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" - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 4, - "name": "setInterpolation" - }, - { - "title": "param", - "description": "Specifies the texture filtering when\n textures are shrunk. Options are LINEAR or NEAREST", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "downScale" - }, - { - "title": "param", - "description": "Specifies the texture filtering when\n textures are magnified. Options are LINEAR or NEAREST", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "upScale" - }, - { - "title": "todo", - "description": "implement mipmapping filters", - "lineNumber": 9 - } - ], - "loc": { - "start": { - "line": 327, - "column": 2, - "index": 11431 - }, - "end": { - "line": 337, - "column": 5, - "index": 12022 - } - }, - "context": { - "loc": { - "start": { - "line": 338, - "column": 2, - "index": 12025 - }, - "end": { - "line": 348, - "column": 3, - "index": 12406 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Texture.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "downScale", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Specifies the texture filtering when\ntextures are shrunk. Options are LINEAR or NEAREST" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "upScale", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Specifies the texture filtering when\ntextures are magnified. Options are LINEAR or NEAREST" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [ - { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "implement mipmapping filters" - } - ] - } - ] - } - ], - "yields": [], - "kind": "function", - "name": "setInterpolation", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setInterpolation", - "kind": "function" - } - ], - "namespace": "setInterpolation" - }, - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "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.)." - } - ] - } - ] - }, - "tags": [ - { - "title": "method", - "description": null, - "lineNumber": 5, - "name": "setWrapMode" - }, - { - "title": "param", - "description": "Controls the horizontal texture wrapping behavior", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "wrapX" - }, - { - "title": "param", - "description": "Controls the vertical texture wrapping behavior", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "String" - }, - "name": "wrapY" - } - ], - "loc": { - "start": { - "line": 359, - "column": 2, - "index": 12578 - }, - "end": { - "line": 367, - "column": 5, - "index": 13051 - } - }, - "context": { - "loc": { - "start": { - "line": 368, - "column": 2, - "index": 13054 - }, - "end": { - "line": 453, - "column": 3, - "index": 15944 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/p5.Texture.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "wrapX", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Controls the horizontal texture wrapping behavior" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - }, - { - "title": "param", - "name": "wrapY", - "lineNumber": 7, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "Controls the vertical texture wrapping behavior" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "String" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "setWrapMode", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setWrapMode", - "kind": "function" - } - ], - "namespace": "setWrapMode" - }, - { - "description": "", - "tags": [ - { - "title": "function", - "description": null, - "lineNumber": 1, - "name": "setPixel" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Object" - }, - "name": "imageInfo" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "r" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "g" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "b" - }, - { - "title": "param", - "description": "writes the next pixel into an indexed ImageData", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "a" - } - ], - "loc": { - "start": { - "line": 115, - "column": 0, - "index": 3305 - }, - "end": { - "line": 124, - "column": 3, - "index": 3501 - } - }, - "context": { - "loc": { - "start": { - "line": 125, - "column": 0, - "index": 3502 - }, - "end": { - "line": 133, - "column": 1, - "index": 3749 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/text.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "imageInfo", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Object" - } - }, - { - "title": "param", - "name": "r", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "g", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "b", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "a", - "lineNumber": 6, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "writes the next pixel into an indexed ImageData" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "setPixel", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "setPixel", - "kind": "function" - } - ], - "namespace": "setPixel" - }, - { - "description": "", - "tags": [ - { - "title": "function", - "description": null, - "lineNumber": 1, - "name": "minMax" - }, - { - "title": "param", - "description": "the list of values to compare", - "lineNumber": 2, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - }, - "name": "rg" - }, - { - "title": "param", - "description": "the initial minimum value", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "min" - }, - { - "title": "param", - "description": "the initial maximum value\n\nfind the minimum & maximum value in a list of values", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "max" - } - ], - "loc": { - "start": { - "line": 202, - "column": 6, - "index": 6195 - }, - "end": { - "line": 209, - "column": 11, - "index": 6489 - } - }, - "context": { - "loc": { - "start": { - "line": 210, - "column": 6, - "index": 6496 - }, - "end": { - "line": 217, - "column": 7, - "index": 6710 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/text.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "rg", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the list of values to compare" - } - ] - } - ] - }, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Number" - } - ] - } - }, - { - "title": "param", - "name": "min", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the initial minimum value" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "max", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the initial maximum value" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "find the minimum & maximum value in a list of values" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "minMax", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "minMax", - "kind": "function" - } - ], - "namespace": "minMax" - }, - { - "description": "", - "tags": [ - { - "title": "function", - "description": null, - "lineNumber": 1, - "name": "clamp" - }, - { - "title": "param", - "description": "the value to clamp", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "v" - }, - { - "title": "param", - "description": "the minimum value", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "min" - }, - { - "title": "param", - "description": "the maxmimum value\n\nclamps a value between a minimum & maximum value", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "max" - } - ], - "loc": { - "start": { - "line": 251, - "column": 4, - "index": 7866 - }, - "end": { - "line": 258, - "column": 9, - "index": 8112 - } - }, - "context": { - "loc": { - "start": { - "line": 259, - "column": 4, - "index": 8117 - }, - "end": { - "line": 263, - "column": 5, - "index": 8230 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/text.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "v", - "lineNumber": 2, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the value to clamp" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "min", - "lineNumber": 3, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the minimum value" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "max", - "lineNumber": 4, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "the maxmimum value" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "clamps a value between a minimum & maximum value" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "clamp", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "clamp", - "kind": "function" - } - ], - "namespace": "clamp" - }, - { - "description": "", - "tags": [ - { - "title": "function", - "description": null, - "lineNumber": 1, - "name": "cubicToQuadratics" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x0" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y0" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "cx0" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "cy0" - }, - { - "title": "param", - "description": null, - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "cx1" - }, - { - "title": "param", - "description": null, - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "cy1" - }, - { - "title": "param", - "description": null, - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x1" - }, - { - "title": "param", - "description": null, - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y1" - }, - { - "title": "returns", - "description": "an array of cubics whose quadratic approximations\n closely match the civen cubic.\n\nconverts a cubic curve to a list of quadratics.", - "lineNumber": 10, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Cubic" - } - ] - } - } - ], - "loc": { - "start": { - "line": 400, - "column": 4, - "index": 12440 - }, - "end": { - "line": 414, - "column": 9, - "index": 12921 - } - }, - "context": { - "loc": { - "start": { - "line": 415, - "column": 4, - "index": 12926 - }, - "end": { - "line": 466, - "column": 5, - "index": 14671 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/text.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x0", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y0", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "cx0", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "cy0", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "cx1", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "cy1", - "lineNumber": 7, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x1", - "lineNumber": 8, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y1", - "lineNumber": 9, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "an array of cubics whose quadratic approximations\nclosely match the civen cubic." - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "converts a cubic curve to a list of quadratics." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "Cubic" - } - ] - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "cubicToQuadratics", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "cubicToQuadratics", - "kind": "function" - } - ], - "namespace": "cubicToQuadratics" - }, - { - "description": "", - "tags": [ - { - "title": "function", - "description": null, - "lineNumber": 1, - "name": "pushLine" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x0" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y0" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x1" - }, - { - "title": "param", - "description": "add a straight line to the row/col grid of a glyph", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y1" - } - ], - "loc": { - "start": { - "line": 468, - "column": 4, - "index": 14677 - }, - "end": { - "line": 476, - "column": 9, - "index": 14899 - } - }, - "context": { - "loc": { - "start": { - "line": 477, - "column": 4, - "index": 14904 - }, - "end": { - "line": 481, - "column": 5, - "index": 15075 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/text.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x0", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y0", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x1", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y1", - "lineNumber": 5, - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "add a straight line to the row/col grid of a glyph" - } - ] - } - ] - }, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "pushLine", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "pushLine", - "kind": "function" - } - ], - "namespace": "pushLine" - }, - { - "description": "", - "tags": [ - { - "title": "function", - "description": null, - "lineNumber": 1, - "name": "samePoint" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x0" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y0" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "x1" - }, - { - "title": "param", - "description": null, - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - }, - "name": "y1" - }, - { - "title": "return", - "description": "true if the two points are sufficiently close\n\ntests if two points are close enough to be considered the same", - "lineNumber": 6, - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "loc": { - "start": { - "line": 483, - "column": 4, - "index": 15081 - }, - "end": { - "line": 492, - "column": 9, - "index": 15389 - } - }, - "context": { - "loc": { - "start": { - "line": 493, - "column": 4, - "index": 15394 - }, - "end": { - "line": 495, - "column": 5, - "index": 15509 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/text.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "x0", - "lineNumber": 2, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y0", - "lineNumber": 3, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "x1", - "lineNumber": 4, - "type": { - "type": "NameExpression", - "name": "Number" - } - }, - { - "title": "param", - "name": "y1", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Number" - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "true if the two points are sufficiently close" - } - ] - }, - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "tests if two points are close enough to be considered the same" - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Boolean" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "samePoint", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "samePoint", - "kind": "function" - } - ], - "namespace": "samePoint" - }, - { - "description": "", - "tags": [ - { - "title": "function", - "description": null, - "lineNumber": 1, - "name": "layout" - }, - { - "title": "param", - "description": null, - "lineNumber": 2, - "type": null, - "errors": [ - "not reach to EOF" - ], - "name": "dim" - }, - { - "title": "param", - "description": null, - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "ImageInfo" - } - ] - }, - "name": "dimImageInfos" - }, - { - "title": "param", - "description": null, - "lineNumber": 4, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "ImageInfo" - } - ] - }, - "name": "cellImageInfos" - }, - { - "title": "return", - "description": "lays out the curves in a dimension (row or col) into two\nimages, one for the indices of the curves themselves, and\none containing the offset and length of those index spans.", - "lineNumber": 5, - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "loc": { - "start": { - "line": 568, - "column": 4, - "index": 17626 - }, - "end": { - "line": 578, - "column": 9, - "index": 18023 - } - }, - "context": { - "loc": { - "start": { - "line": 579, - "column": 4, - "index": 18028 - }, - "end": { - "line": 620, - "column": 5, - "index": 19453 - } - }, - "file": "/Users/dpagurek/Documents/Projects/p5.js/src/webgl/text.js" - }, - "augments": [], - "examples": [], - "implements": [], - "params": [ - { - "title": "param", - "name": "dimImageInfos", - "lineNumber": 3, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "ImageInfo" - } - ] - } - }, - { - "title": "param", - "name": "cellImageInfos", - "lineNumber": 4, - "type": { - "type": "TypeApplication", - "expression": { - "type": "NameExpression", - "name": "Array" - }, - "applications": [ - { - "type": "NameExpression", - "name": "ImageInfo" - } - ] - } - } - ], - "properties": [], - "returns": [ - { - "description": { - "type": "root", - "children": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "value": "lays out the curves in a dimension (row or col) into two\nimages, one for the indices of the curves themselves, and\none containing the offset and length of those index spans." - } - ] - } - ] - }, - "title": "returns", - "type": { - "type": "NameExpression", - "name": "Object" - } - } - ], - "sees": [], - "throws": [], - "todos": [], - "yields": [], - "kind": "function", - "name": "layout", - "members": { - "global": [], - "inner": [], - "instance": [], - "events": [], - "static": [] - }, - "path": [ - { - "name": "layout", - "kind": "function" - } - ], - "namespace": "layout" - } -] \ No newline at end of file