",
- "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\n
angleMode 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\n
angleMode 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": "
\nBLEND
- linear interpolation of colours: C =\nA*factor + B. This is the default blending mode. \nADD
- sum of A and B \nDARKEST
- only the darkest colour succeeds: C =\nmin(A*factor, B). \nLIGHTEST
- only the lightest colour succeeds: C =\nmax(A*factor, B). \nDIFFERENCE
- subtract colors from underlying image.\n(2D) \nEXCLUSION
- similar to DIFFERENCE
, but less\nextreme. \nMULTIPLY
- multiply the colors, result will always be\ndarker. \nSCREEN
- opposite multiply, uses inverse values of the\ncolors. \nREPLACE
- the pixels entirely replace the others and\ndon't utilize alpha (transparency) values. \nREMOVE
- removes pixels from B with the alpha strength of A. \nOVERLAY
- mix of MULTIPLY
and SCREEN\n
. Multiplies dark values, and screens light values. (2D) \nHARD_LIGHT
- SCREEN
when greater than 50%\ngray, MULTIPLY
when lower. (2D) \nSOFT_LIGHT
- mix of DARKEST
and\nLIGHTEST
. Works like OVERLAY
, but not as harsh. (2D)\n \nDODGE
- lightens light tones and increases contrast,\nignores darks. (2D) \nBURN
- darker areas are applied, increasing contrast,\nignores lights. (2D) \nSUBTRACT
- 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