p5.js-web-editor/static/interceptor/data.min.json
Mathura MG ced885d03f Add multiple canvas text outputs (#197)
* added grid

* add table to textoutput

* add all three outputs

* add shortcuts

* fix sound bug for triangle

* fix triangle bug - again
2016-11-12 11:53:02 -05:00

1 line
688 KiB
JSON

{"project":{},"files":{"src/color/color_conversion.js":{"name":"src/color/color_conversion.js","modules":{},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/color/creating_reading.js":{"name":"src/color/creating_reading.js","modules":{"Creating & Reading":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/color/p5.Color.js":{"name":"src/color/p5.Color.js","modules":{},"classes":{"p5.Color":1},"fors":{"p5":1},"namespaces":{}},"src/color/setting.js":{"name":"src/color/setting.js","modules":{"Setting":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/core/2d_primitives.js":{"name":"src/core/2d_primitives.js","modules":{"2D Primitives":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/core/attributes.js":{"name":"src/core/attributes.js","modules":{"Attributes":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/core/canvas.js":{"name":"src/core/canvas.js","modules":{},"classes":{},"fors":{},"namespaces":{}},"src/core/constants.js":{"name":"src/core/constants.js","modules":{"Constants":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/core/core.js":{"name":"src/core/core.js","modules":{"Structure":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/core/curves.js":{"name":"src/core/curves.js","modules":{"Curves":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/core/environment.js":{"name":"src/core/environment.js","modules":{"Environment":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/core/error_helpers.js":{"name":"src/core/error_helpers.js","modules":{},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/core/p5.Element.js":{"name":"src/core/p5.Element.js","modules":{"DOM":1},"classes":{"p5.Element":1},"fors":{"p5.Element":1},"namespaces":{}},"src/core/p5.Graphics.js":{"name":"src/core/p5.Graphics.js","modules":{"Rendering":1},"classes":{"p5.Graphics":1},"fors":{"p5":1},"namespaces":{}},"src/core/p5.Renderer.js":{"name":"src/core/p5.Renderer.js","modules":{},"classes":{"p5.Renderer":1},"fors":{"p5":1},"namespaces":{}},"src/core/p5.Renderer2D.js":{"name":"src/core/p5.Renderer2D.js","modules":{},"classes":{},"fors":{},"namespaces":{}},"src/core/rendering.js":{"name":"src/core/rendering.js","modules":{},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/core/shim.js":{"name":"src/core/shim.js","modules":{},"classes":{},"fors":{},"namespaces":{}},"src/core/structure.js":{"name":"src/core/structure.js","modules":{},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/core/transform.js":{"name":"src/core/transform.js","modules":{"Transform":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/core/vertex.js":{"name":"src/core/vertex.js","modules":{"Vertex":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/events/acceleration.js":{"name":"src/events/acceleration.js","modules":{"Acceleration":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/events/keyboard.js":{"name":"src/events/keyboard.js","modules":{"Keyboard":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/events/mouse.js":{"name":"src/events/mouse.js","modules":{"Mouse":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/events/touch.js":{"name":"src/events/touch.js","modules":{"Touch":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/image/filters.js":{"name":"src/image/filters.js","modules":{},"classes":{},"fors":{},"namespaces":{}},"src/image/image.js":{"name":"src/image/image.js","modules":{"Image":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/image/loading_displaying.js":{"name":"src/image/loading_displaying.js","modules":{"Loading & Displaying":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/image/p5.Image.js":{"name":"src/image/p5.Image.js","modules":{},"classes":{"p5.Image":1},"fors":{},"namespaces":{}},"src/image/pixels.js":{"name":"src/image/pixels.js","modules":{"Pixels":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/io/files.js":{"name":"src/io/files.js","modules":{"Input":1,"Output":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/io/p5.Table.js":{"name":"src/io/p5.Table.js","modules":{"Table":1},"classes":{"p5.Table":1},"fors":{},"namespaces":{}},"src/io/p5.TableRow.js":{"name":"src/io/p5.TableRow.js","modules":{},"classes":{"p5.TableRow":1},"fors":{},"namespaces":{}},"src/io/p5.XML.js":{"name":"src/io/p5.XML.js","modules":{"XML":1},"classes":{"p5.XML":1},"fors":{},"namespaces":{}},"src/math/calculation.js":{"name":"src/math/calculation.js","modules":{"Calculation":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/math/math.js":{"name":"src/math/math.js","modules":{"Math":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/math/noise.js":{"name":"src/math/noise.js","modules":{"Noise":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/math/p5.Vector.js":{"name":"src/math/p5.Vector.js","modules":{},"classes":{"p5.Vector":1},"fors":{},"namespaces":{}},"src/math/random.js":{"name":"src/math/random.js","modules":{"Random":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/math/trigonometry.js":{"name":"src/math/trigonometry.js","modules":{"Trigonometry":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/typography/attributes.js":{"name":"src/typography/attributes.js","modules":{},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/typography/loading_displaying.js":{"name":"src/typography/loading_displaying.js","modules":{},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/typography/p5.Font.js":{"name":"src/typography/p5.Font.js","modules":{"Font":1},"classes":{"p5.Font":1},"fors":{},"namespaces":{}},"src/utilities/array_functions.js":{"name":"src/utilities/array_functions.js","modules":{"Array Functions":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/utilities/conversion.js":{"name":"src/utilities/conversion.js","modules":{"Conversion":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/utilities/string_functions.js":{"name":"src/utilities/string_functions.js","modules":{"String Functions":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/utilities/time_date.js":{"name":"src/utilities/time_date.js","modules":{"Time & Date":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/webgl/camera.js":{"name":"src/webgl/camera.js","modules":{"Camera":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/webgl/light.js":{"name":"src/webgl/light.js","modules":{"Lights":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/webgl/loading.js":{"name":"src/webgl/loading.js","modules":{"3D Models":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/webgl/material.js":{"name":"src/webgl/material.js","modules":{"Material":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/webgl/p5.Geometry.js":{"name":"src/webgl/p5.Geometry.js","modules":{},"classes":{},"fors":{},"namespaces":{}},"src/webgl/p5.Matrix.js":{"name":"src/webgl/p5.Matrix.js","modules":{},"classes":{},"fors":{},"namespaces":{}},"src/webgl/p5.RendererGL.Immediate.js":{"name":"src/webgl/p5.RendererGL.Immediate.js","modules":{},"classes":{},"fors":{},"namespaces":{}},"src/webgl/p5.RendererGL.Retained.js":{"name":"src/webgl/p5.RendererGL.Retained.js","modules":{},"classes":{},"fors":{},"namespaces":{}},"src/webgl/p5.RendererGL.js":{"name":"src/webgl/p5.RendererGL.js","modules":{},"classes":{"p5.RendererGL":1},"fors":{},"namespaces":{}},"src/webgl/primitives.js":{"name":"src/webgl/primitives.js","modules":{"3D Primitives":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"src/app.js":{"name":"src/app.js","modules":{},"classes":{},"fors":{},"namespaces":{}},"lib/addons/p5.dom.js":{"name":"lib/addons/p5.dom.js","modules":{"p5.dom":1},"classes":{"p5.MediaElement":1,"p5.File":1},"fors":{"p5.dom":1,"p5.Element":1},"namespaces":{}},"lib/addons/p5.sound.js":{"name":"lib/addons/p5.sound.js","modules":{"p5.sound":1},"classes":{"p5.SoundFile":1,"p5.Amplitude":1,"p5.FFT":1,"p5.Signal":1,"p5.Oscillator":1,"p5.Env":1,"p5.Pulse":1,"p5.Noise":1,"p5.AudioIn":1,"p5.Filter":1,"p5.Delay":1,"p5.Reverb":1,"p5.Convolver":1,"p5.Phrase":1,"p5.Part":1,"p5.Score":1,"p5.SoundRecorder":1,"p5.PeakDetect":1,"p5.Gain":1},"fors":{"p5.sound":1},"namespaces":{}}},"modules":{"Color":{"name":"Color","submodules":{"Creating & Reading":1,"Setting":1},"classes":{"p5.Color":1},"fors":{"p5":1},"namespaces":{},"file":"src/color/p5.Color.js","line":14},"Creating & Reading":{"name":"Creating & Reading","submodules":{},"classes":{"p5.Color":1},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Color","namespace":"","file":"src/color/p5.Color.js","line":14,"requires":["core","constants"],"description":"<p>We define colors to be immutable objects. Each color stores the color mode\nand level maxes that applied at the time of its construction. These are\nused to interpret the input arguments and to format the output e.g. when\nsaturation() is requested.</p>\n<p>Internally we store an array representing the ideal RGBA values in floating\npoint form, normalized from 0 to 1. From this we calculate the closest\nscreen color (RGBA levels from 0 to 255) and expose this to the renderer.</p>\n<p>We also cache normalized, floating point components of the color in various\nrepresentations as they are calculated. This is done to prevent repeating a\nconversion that has already been performed.</p>\n"},"Setting":{"name":"Setting","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Color","namespace":"","file":"src/color/setting.js","line":1,"requires":["core","constants"]},"Shape":{"name":"Shape","submodules":{"2D Primitives":1,"Curves":1,"Vertex":1,"3D Models":1,"3D Primitives":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"2D Primitives":{"name":"2D Primitives","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Shape","namespace":"","file":"src/core/2d_primitives.js","line":1,"requires":["core","constants"]},"Attributes":{"name":"Attributes","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Typography","namespace":"","file":"src/core/attributes.js","line":1,"requires":["core","constants"]},"Constants":{"name":"Constants","submodules":{},"classes":{},"fors":{"p5":1},"namespaces":{},"module":"Constants","file":"src/core/constants.js","line":1},"Structure":{"name":"Structure","submodules":{},"classes":{},"fors":{"p5":1},"namespaces":{},"module":"Structure","file":"src/core/core.js","line":1,"requires":["constants"]},"Curves":{"name":"Curves","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Shape","namespace":"","file":"src/core/curves.js","line":1,"requires":["core"]},"Environment":{"name":"Environment","submodules":{},"classes":{},"fors":{"p5":1},"namespaces":{},"module":"Environment","file":"src/core/environment.js","line":1,"requires":["core","constants"]},"DOM":{"name":"DOM","submodules":{},"classes":{"p5.Element":1},"fors":{"p5.Element":1},"namespaces":{},"module":"DOM","file":"src/core/p5.Element.js","line":9,"description":"<p>Base class for all elements added to a sketch, including canvas,\ngraphics buffers, and other HTML elements. Methods in blue are\nincluded in the core functionality, methods in brown are added\nwith the <a href=\"http://p5js.org/reference/#/libraries/p5.dom\">p5.dom\nlibrary</a>.\nIt is not called directly, but p5.Element\nobjects are created by calling createCanvas, createGraphics,\nor in the p5.dom library, createDiv, createImg, createInput, etc.</p>\n"},"Rendering":{"name":"Rendering","submodules":{},"classes":{"p5.Graphics":1,"p5.Renderer":1},"fors":{"p5":1},"namespaces":{},"module":"Rendering","file":"src/core/p5.Renderer.js","line":10,"description":"<p>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.</p>\n"},"Transform":{"name":"Transform","submodules":{},"classes":{},"fors":{"p5":1},"namespaces":{},"module":"Transform","file":"src/core/transform.js","line":1,"requires":["core","constants"]},"Vertex":{"name":"Vertex","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Shape","namespace":"","file":"src/core/vertex.js","line":1,"requires":["core","constants"]},"Events":{"name":"Events","submodules":{"Acceleration":1,"Keyboard":1,"Mouse":1,"Touch":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"Acceleration":{"name":"Acceleration","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Events","namespace":"","file":"src/events/acceleration.js","line":1,"requires":["core"]},"Keyboard":{"name":"Keyboard","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Events","namespace":"","file":"src/events/keyboard.js","line":1,"requires":["core"]},"Mouse":{"name":"Mouse","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Events","namespace":"","file":"src/events/mouse.js","line":1,"requires":["core","constants"]},"Touch":{"name":"Touch","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Events","namespace":"","file":"src/events/touch.js","line":1,"requires":["core"]},"Image":{"name":"Image","submodules":{"Pixels":1},"classes":{"p5.Image":1},"fors":{"p5":1},"namespaces":{},"module":"Image","file":"src/image/p5.Image.js","line":23,"requires":["core"],"description":"<p>Creates a new p5.Image. A p5.Image is a canvas backed representation of an\nimage.\n<br><br>\np5 can display .gif, .jpg and .png images. Images may be displayed\nin 2D and 3D space. Before an image is used, it must be loaded with the\nloadImage() function. The p5.Image class contains fields for the width and\nheight of the image, as well as an array called pixels[] that contains the\nvalues for every pixel in the image.\n<br><br>\nThe methods described below allow easy access to the image&#39;s pixels and\nalpha channel and simplify the process of compositing.\n<br><br>\nBefore using the pixels[] array, be sure to use the loadPixels() method on\nthe image to make sure that the pixel data is properly loaded.</p>\n"},"Loading & Displaying":{"name":"Loading & Displaying","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Typography","namespace":"","file":"src/image/loading_displaying.js","line":1,"requires":["core"]},"Pixels":{"name":"Pixels","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Image","namespace":"","file":"src/image/pixels.js","line":1,"requires":["core"]},"IO":{"name":"IO","submodules":{"undefined":1,"Input":1,"Output":1,"Table":1,"XML":1,"Time & Date":1},"classes":{"p5":1,"p5.Table":1,"p5.TableRow":1,"p5.XML":1},"fors":{"p5":1},"namespaces":{},"file":"src/io/p5.XML.js","line":11},"Input":{"name":"Input","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"IO","namespace":"","file":"src/io/files.js","line":1,"requires":["core","reqwest"]},"Output":{"name":"Output","submodules":{},"classes":{"p5":1},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"IO","namespace":"","file":"src/io/files.js","line":897},"Table":{"name":"Table","submodules":{},"classes":{"p5.Table":1,"p5.TableRow":1},"fors":{},"is_submodule":1,"namespaces":{},"module":"IO","namespace":"","file":"src/io/p5.TableRow.js","line":11,"requires":["core"],"description":"<p>Table objects store data with multiple rows and columns, much\nlike in a traditional spreadsheet. Tables can be generated from\nscratch, dynamically, or using data from an existing file.</p>\n"},"XML":{"name":"XML","submodules":{},"classes":{"p5.XML":1},"fors":{},"is_submodule":1,"namespaces":{},"module":"IO","namespace":"","file":"src/io/p5.XML.js","line":11,"requires":["core"],"description":"<p>XML is a representation of an XML object, able to parse XML code. Use\nloadXML() to load external XML files and create XML objects.</p>\n"},"Math":{"name":"Math","submodules":{"Calculation":1,"Noise":1,"Random":1,"Trigonometry":1},"classes":{"p5.Vector":1},"fors":{"p5":1},"namespaces":{},"module":"Math","file":"src/math/p5.Vector.js","line":13,"requires":["core"],"description":"<p>A class to describe a two or three dimensional vector, specifically\na Euclidean (also known as geometric) vector. A vector is an entity\nthat has both magnitude and direction. The datatype, however, stores\nthe components of the vector (x, y for 2D, and x, y, z for 3D). The magnitude\nand direction can be accessed via the methods mag() and heading().\n<br><br>\nIn many of the p5.js examples, you will see p5.Vector used to describe a\nposition, velocity, or acceleration. For example, if you consider a rectangle\nmoving across the screen, at any given instant it has a position (a vector\nthat points from the origin to its location), a velocity (the rate at which\nthe object&#39;s position changes per time unit, expressed as a vector), and\nacceleration (the rate at which the object&#39;s velocity changes per time\nunit, expressed as a vector).\n<br><br>\nSince vectors represent groupings of values, we cannot simply use\ntraditional addition/multiplication/etc. Instead, we&#39;ll need to do some\n&quot;vector&quot; math, which is made easy by the methods inside the p5.Vector class.</p>\n"},"Calculation":{"name":"Calculation","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Math","namespace":"","file":"src/math/calculation.js","line":1,"requires":["core"]},"Noise":{"name":"Noise","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Math","namespace":"","file":"src/math/noise.js","line":14,"requires":["core"]},"Random":{"name":"Random","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Math","namespace":"","file":"src/math/random.js","line":1,"requires":["core"]},"Trigonometry":{"name":"Trigonometry","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Math","namespace":"","file":"src/math/trigonometry.js","line":1,"requires":["core","polargeometry","constants"]},"Typography":{"name":"Typography","submodules":{"Attributes":1,"Loading & Displaying":1,"Font":1},"classes":{"p5.Font":1},"fors":{"p5":1},"namespaces":{},"file":"src/typography/p5.Font.js","line":32},"Font":{"name":"Font","submodules":{},"classes":{"p5.Font":1},"fors":{},"is_submodule":1,"namespaces":{},"module":"Typography","namespace":"","file":"src/typography/p5.Font.js","line":32,"description":"<p>This module defines the p5.Font class and functions for\ndrawing text to the display canvas.</p>\n","requires":["core","constants"]},"Data":{"name":"Data","submodules":{"Array Functions":1,"Conversion":1,"String Functions":1},"classes":{},"fors":{"p5":1},"namespaces":{}},"Array Functions":{"name":"Array Functions","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Data","namespace":"","file":"src/utilities/array_functions.js","line":1,"requires":["core"]},"Conversion":{"name":"Conversion","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Data","namespace":"","file":"src/utilities/conversion.js","line":1,"requires":["core"]},"String Functions":{"name":"String Functions","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Data","namespace":"","file":"src/utilities/string_functions.js","line":1,"requires":["core"]},"Time & Date":{"name":"Time & Date","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"IO","namespace":"","file":"src/utilities/time_date.js","line":1,"requires":["core"]},"Lights, Camera":{"name":"Lights, Camera","submodules":{"Camera":1,"Lights":1,"Material":1},"classes":{"p5.RendererGL":1},"fors":{"p5":1},"namespaces":{},"file":"src/webgl/p5.RendererGL.js","line":21},"Camera":{"name":"Camera","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Lights, Camera","namespace":"","file":"src/webgl/camera.js","line":1,"requires":["core"]},"Lights":{"name":"Lights","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Lights, Camera","namespace":"","file":"src/webgl/light.js","line":1,"requires":["core"]},"3D Models":{"name":"3D Models","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Shape","namespace":"","file":"src/webgl/loading.js","line":1,"requires":["core","p5.Geometry3D"]},"Material":{"name":"Material","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Lights, Camera","namespace":"","file":"src/webgl/material.js","line":1,"requires":["core"]},"3D Primitives":{"name":"3D Primitives","submodules":{},"classes":{},"fors":{"p5":1},"is_submodule":1,"namespaces":{},"module":"Shape","namespace":"","file":"src/webgl/primitives.js","line":1,"requires":["core","p5.Geometry"]},"p5.dom":{"name":"p5.dom","submodules":{},"classes":{"p5.dom":1,"p5.MediaElement":1,"p5.File":1},"fors":{"p5.dom":1,"p5.Element":1},"namespaces":{},"module":"p5.dom","file":"lib/addons/p5.dom.js","line":2090,"description":"<p><p>The web is much more than just canvas and p5.dom makes it easy to interact\nwith other HTML5 objects, including text, hyperlink, image, input, video,\naudio, and webcam.</p></p>\n<p><p>There is a set of creation methods, DOM manipulation methods, and\nan extended p5.Element that supports a range of HTML elements. See the\n<a href=\"https://github.com/processing/p5.js/wiki/Beyond-the-canvas\">\nbeyond the canvas tutorial</a> for a full overview of how this addon works.</p>\n<p><p>Methods and properties shown in black are part of the p5.js core, items in\nblue are part of the p5.dom library. You will need to include an extra file\nin order to access the blue functions. See the\n<a href=\"http://p5js.org/libraries/#using-a-library\">using a library</a>\nsection for information on how to include this library. p5.dom comes with\n<a href=\"http://p5js.org/download\">p5 complete</a> or you can download the single file\n<a href=\"https://raw.githubusercontent.com/lmccart/p5.js/master/lib/addons/p5.dom.js\">\nhere</a>.</p></p>\n<p><p>See <a href=\"https://github.com/processing/p5.js/wiki/Beyond-the-canvas\">tutorial: beyond the canvas</a>\nfor more info on how to use this libary.</a></p>\n","tag":"main","itemtype":"main"},"p5.sound":{"name":"p5.sound","submodules":{},"classes":{"p5.sound":1,"p5.SoundFile":1,"p5.Amplitude":1,"p5.FFT":1,"p5.Signal":1,"p5.Oscillator":1,"p5.Env":1,"p5.Pulse":1,"p5.Noise":1,"p5.AudioIn":1,"p5.Filter":1,"p5.Delay":1,"p5.Reverb":1,"p5.Convolver":1,"p5.Phrase":1,"p5.Part":1,"p5.Score":1,"p5.SoundRecorder":1,"p5.PeakDetect":1,"p5.Gain":1},"fors":{"p5.sound":1},"namespaces":{},"module":"p5.sound","file":"lib/addons/p5.sound.js","line":8897,"description":"<p>p5.sound extends p5 with <a href=\"http://caniuse.com/audio-api\"\ntarget=\"_blank\">Web Audio</a> functionality including audio input,\nplayback, analysis and synthesis.\n<br/><br/>\n<a href=\"#/p5.SoundFile\"><b>p5.SoundFile</b></a>: Load and play sound files.<br/>\n<a href=\"#/p5.Amplitude\"><b>p5.Amplitude</b></a>: Get the current volume of a sound.<br/>\n<a href=\"#/p5.AudioIn\"><b>p5.AudioIn</b></a>: Get sound from an input source, typically\n a computer microphone.<br/>\n<a href=\"#/p5.FFT\"><b>p5.FFT</b></a>: Analyze the frequency of sound. Returns\n results from the frequency spectrum or time domain (waveform).<br/>\n<a href=\"#/p5.Oscillator\"><b>p5.Oscillator</b></a>: Generate Sine,\n Triangle, Square and Sawtooth waveforms. Base class of\n <a href=\"#/p5.Noise\">p5.Noise</a> and <a href=\"#/p5.Pulse\">p5.Pulse</a>.\n <br/>\n<a href=\"#/p5.Env\"><b>p5.Env</b></a>: An Envelope is a series\n of fades over time. Often used to control an object&#39;s\n output gain level as an &quot;ADSR Envelope&quot; (Attack, Decay,\n Sustain, Release). Can also modulate other parameters.<br/>\n<a href=\"#/p5.Delay\"><b>p5.Delay</b></a>: A delay effect with\n parameters for feedback, delayTime, and lowpass filter.<br/>\n<a href=\"#/p5.Filter\"><b>p5.Filter</b></a>: Filter the frequency range of a\n sound.\n<br/>\n<a href=\"#/p5.Reverb\"><b>p5.Reverb</b></a>: Add reverb to a sound by specifying\n duration and decay. <br/>\n<b><a href=\"#/p5.Convolver\">p5.Convolver</a>:</b> Extends\n<a href=\"#/p5.Reverb\">p5.Reverb</a> to simulate the sound of real\n physical spaces through convolution.<br/>\n<b><a href=\"#/p5.SoundRecorder\">p5.SoundRecorder</a></b>: Record sound for playback \n / save the .wav file.\n<b><a href=\"#/p5.Phrase\">p5.Phrase</a></b>, <b><a href=\"#/p5.Part\">p5.Part</a></b> and\n<b><a href=\"#/p5.Score\">p5.Score</a></b>: Compose musical sequences.\n<br/><br/>\np5.sound is on <a href=\"https://github.com/therewasaguy/p5.sound/\">GitHub</a>.\nDownload the latest version \n<a href=\"https://github.com/therewasaguy/p5.sound/blob/master/lib/p5.sound.js\">here</a>.</p>\n","tag":"main","itemtype":"main"}},"classes":{"p5":{"name":"p5","shortname":"p5","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"IO","submodule":"Output"},"p5.Color":{"name":"p5.Color","shortname":"p5.Color","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"Color","submodule":"Creating & Reading","file":"src/color/p5.Color.js","line":14,"description":"<p>We define colors to be immutable objects. Each color stores the color mode\nand level maxes that applied at the time of its construction. These are\nused to interpret the input arguments and to format the output e.g. when\nsaturation() is requested.</p>\n<p>Internally we store an array representing the ideal RGBA values in floating\npoint form, normalized from 0 to 1. From this we calculate the closest\nscreen color (RGBA levels from 0 to 255) and expose this to the renderer.</p>\n<p>We also cache normalized, floating point components of the color in various\nrepresentations as they are calculated. This is done to prevent repeating a\nconversion that has already been performed.</p>\n","is_constructor":1},"p5.Element":{"name":"p5.Element","shortname":"p5.Element","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"DOM","submodule":"DOM","namespace":"","file":"src/core/p5.Element.js","line":9,"description":"<p>Base class for all elements added to a sketch, including canvas,\ngraphics buffers, and other HTML elements. Methods in blue are\nincluded in the core functionality, methods in brown are added\nwith the <a href=\"http://p5js.org/reference/#/libraries/p5.dom\">p5.dom\nlibrary</a>.\nIt is not called directly, but p5.Element\nobjects are created by calling createCanvas, createGraphics,\nor in the p5.dom library, createDiv, createImg, createInput, etc.</p>\n","is_constructor":1,"params":[{"name":"elt","description":"<p>DOM node that is wrapped</p>\n","type":"String"},{"name":"pInst","description":"<p>pointer to p5 instance</p>\n","type":"Object","optional":true}]},"p5.Graphics":{"name":"p5.Graphics","shortname":"p5.Graphics","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"Rendering","submodule":"Rendering","file":"src/core/p5.Graphics.js","line":10,"description":"<p>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.</p>\n","is_constructor":1,"extends":"p5.Element","params":[{"name":"elt","description":"<p>DOM node that is wrapped</p>\n","type":"String"},{"name":"pInst","description":"<p>pointer to p5 instance</p>\n","type":"Object","optional":true},{"name":"whether","description":"<p>we&#39;re using it as main canvas</p>\n","type":"Boolean"}]},"p5.Renderer":{"name":"p5.Renderer","shortname":"p5.Renderer","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"Rendering","submodule":"Rendering","file":"src/core/p5.Renderer.js","line":10,"description":"<p>Main graphics and rendering context, as well as the base API\nimplementation for p5.js &quot;core&quot;. To be used as the superclass for\nRenderer2D and Renderer3D classes, respecitvely.</p>\n","is_constructor":1,"extends":"p5.Element","params":[{"name":"elt","description":"<p>DOM node that is wrapped</p>\n","type":"String"},{"name":"pInst","description":"<p>pointer to p5 instance</p>\n","type":"Object","optional":true},{"name":"whether","description":"<p>we&#39;re using it as main canvas</p>\n","type":"Boolean"}]},"p5.Image":{"name":"p5.Image","shortname":"p5.Image","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"Image","submodule":"Image","namespace":"","file":"src/image/p5.Image.js","line":23,"description":"<p>Creates a new p5.Image. A p5.Image is a canvas backed representation of an\nimage.\n<br><br>\np5 can display .gif, .jpg and .png images. Images may be displayed\nin 2D and 3D space. Before an image is used, it must be loaded with the\nloadImage() function. The p5.Image class contains fields for the width and\nheight of the image, as well as an array called pixels[] that contains the\nvalues for every pixel in the image.\n<br><br>\nThe methods described below allow easy access to the image&#39;s pixels and\nalpha channel and simplify the process of compositing.\n<br><br>\nBefore using the pixels[] array, be sure to use the loadPixels() method on\nthe image to make sure that the pixel data is properly loaded.</p>\n","is_constructor":1,"params":[{"name":"width","description":"","type":"Number"},{"name":"height","description":"","type":"Number"},{"name":"pInst","description":"<p>An instance of a p5 sketch.</p>\n","type":"Object"}]},"p5.Table":{"name":"p5.Table","shortname":"p5.Table","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"IO","submodule":"Table","namespace":"","file":"src/io/p5.Table.js","line":36,"description":"<p>Table objects store data with multiple rows and columns, much\nlike in a traditional spreadsheet. Tables can be generated from\nscratch, dynamically, or using data from an existing file.</p>\n","is_constructor":1,"params":[{"name":"rows","description":"<p>An array of p5.TableRow objects</p>\n","type":"Array","optional":true}],"return":{"description":"p5.Table generated","type":"p5.Table"}},"p5.TableRow":{"name":"p5.TableRow","shortname":"p5.TableRow","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"IO","submodule":"Table","namespace":"","file":"src/io/p5.TableRow.js","line":11,"description":"<p>A TableRow object represents a single row of data values,\nstored in columns, from a table.</p>\n<p>A Table Row contains both an ordered array, and an unordered\nJSON object.</p>\n","is_constructor":1,"params":[{"name":"str","description":"<p>optional: populate the row with a\n string of values, separated by the\n separator</p>\n","type":"String","optional":true},{"name":"separator","description":"<p>comma separated values (csv) by default</p>\n","type":"String","optional":true}]},"p5.XML":{"name":"p5.XML","shortname":"p5.XML","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"IO","submodule":"XML","namespace":"","file":"src/io/p5.XML.js","line":11,"description":"<p>XML is a representation of an XML object, able to parse XML code. Use\nloadXML() to load external XML files and create XML objects.</p>\n","is_constructor":1,"return":{"description":"p5.XML object generated","type":"p5.XML"},"example":["\n<div class='norender'><code>\n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// <?xml version=\"1.0\"?>\n// &lt;mammals&gt;\n// &lt;animal id=\"0\" species=\"Capra hircus\">Goat&lt;/animal&gt;\n// &lt;animal id=\"1\" species=\"Panthera pardus\">Leopard&lt;/animal&gt;\n// &lt;animal id=\"2\" species=\"Equus zebra\">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nvar xml;\n\nfunction preload() {\n xml = loadXML(\"assets/mammals.xml\");\n}\n\nfunction setup() {\n var children = xml.getChildren(\"animal\");\n\n for (var i = 0; i < children.length; i++) {\n var id = children[i].getNumber(\"id\");\n var coloring = children[i].getString(\"species\");\n var name = children[i].getContent();\n println(id + \", \" + coloring + \", \" + name);\n }\n}\n\n// Sketch prints:\n// 0, Capra hircus, Goat\n// 1, Panthera pardus, Leopard\n// 2, Equus zebra, Zebra\n</code></div>"]},"p5.Vector":{"name":"p5.Vector","shortname":"p5.Vector","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"Math","submodule":"Math","namespace":"","file":"src/math/p5.Vector.js","line":13,"description":"<p>A class to describe a two or three dimensional vector, specifically\na Euclidean (also known as geometric) vector. A vector is an entity\nthat has both magnitude and direction. The datatype, however, stores\nthe components of the vector (x, y for 2D, and x, y, z for 3D). The magnitude\nand direction can be accessed via the methods mag() and heading().\n<br><br>\nIn many of the p5.js examples, you will see p5.Vector used to describe a\nposition, velocity, or acceleration. For example, if you consider a rectangle\nmoving across the screen, at any given instant it has a position (a vector\nthat points from the origin to its location), a velocity (the rate at which\nthe object&#39;s position changes per time unit, expressed as a vector), and\nacceleration (the rate at which the object&#39;s velocity changes per time\nunit, expressed as a vector).\n<br><br>\nSince vectors represent groupings of values, we cannot simply use\ntraditional addition/multiplication/etc. Instead, we&#39;ll need to do some\n&quot;vector&quot; math, which is made easy by the methods inside the p5.Vector class.</p>\n","is_constructor":1,"params":[{"name":"x","description":"<p>x component of the vector</p>\n","type":"Number","optional":true},{"name":"y","description":"<p>y component of the vector</p>\n","type":"Number","optional":true},{"name":"z","description":"<p>z component of the vector</p>\n","type":"Number","optional":true}],"example":["\n<div>\n<code>\nvar v1 = createVector(40, 50);\nvar v2 = createVector(40, 50);\n\nellipse(v1.x, v1.y, 50, 50);\nellipse(v2.x, v2.y, 50, 50);\nv1.add(v2);\nellipse(v1.x, v1.y, 50, 50);\n</code>\n</div>"]},"p5.Font":{"name":"p5.Font","shortname":"p5.Font","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"Typography","submodule":"Font","namespace":"","file":"src/typography/p5.Font.js","line":32,"description":"<p>Base class for font handling</p>\n","is_constructor":1,"params":[{"name":"pInst","description":"<p>pointer to p5 instance</p>\n","type":"Object","optional":true}]},"p5.RendererGL":{"name":"p5.RendererGL","shortname":"p5.RendererGL","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"Lights, Camera","file":"src/webgl/p5.RendererGL.js","line":21,"is_constructor":1,"extends":"p5.Renderer\n3D graphics class.","todo":["extend class to include public method for offscreen\nrendering (FBO)."]},"p5.dom":{"name":"p5.dom","shortname":"p5.dom","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.dom","submodule":"p5.dom","namespace":""},"p5.MediaElement":{"name":"p5.MediaElement","shortname":"p5.MediaElement","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.dom","submodule":"p5.dom","namespace":"","file":"lib/addons/p5.dom.js","line":1596,"description":"<p>Extends p5.Element to handle audio and video. In addition to the methods\nof p5.Element, it also contains methods for controlling media. It is not\ncalled directly, but p5.MediaElements are created by calling createVideo,\ncreateAudio, and createCapture.</p>\n","is_constructor":1,"params":[{"name":"elt","description":"<p>DOM node that is wrapped</p>\n","type":"String"},{"name":"pInst","description":"<p>pointer to p5 instance</p>\n","type":"Object","optional":true}]},"p5.File":{"name":"p5.File","shortname":"p5.File","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.dom","submodule":"p5.dom","namespace":"","file":"lib/addons/p5.dom.js","line":2090,"description":"<p>Base class for a file\nUsing this for createFileInput</p>\n","is_constructor":1,"params":[{"name":"file","description":"<p>File that is wrapped</p>\n","type":"File"},{"name":"pInst","description":"<p>pointer to p5 instance</p>\n","type":"Object","optional":true}]},"p5.sound":{"name":"p5.sound","shortname":"p5.sound","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.sound","submodule":"p5.sound","namespace":""},"p5.SoundFile":{"name":"p5.SoundFile","shortname":"p5.SoundFile","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.sound","submodule":"p5.sound","namespace":"","file":"lib/addons/p5.sound.js","line":738,"description":"<p>SoundFile object with a path to a file.</p>\n\n<p>The p5.SoundFile may not be available immediately because\nit loads the file information asynchronously.</p>\n\n<p>To do something with the sound as soon as it loads\npass the name of a function as the second parameter.</p>\n\n<p>Only one file path is required. However, audio file formats \n(i.e. mp3, ogg, wav and m4a/aac) are not supported by all\nweb browsers. If you want to ensure compatability, instead of a single\nfile path, you may include an Array of filepaths, and the browser will\nchoose a format that works.</p>","is_constructor":1,"params":[{"name":"path","description":"<p>path to a sound file (String). Optionally,\n you may include multiple file formats in\n an array. Alternately, accepts an object\n from the HTML5 File API, or a p5.File.</p>\n","type":"String/Array"},{"name":"successCallback","description":"<p>Name of a function to call once file loads</p>\n","type":"Function","optional":true},{"name":"errorCallback","description":"<p>Name of a function to call if file fails to\n load. This function will receive an error or\n XMLHttpRequest object with information\n about what went wrong.</p>\n","type":"Function","optional":true},{"name":"whileLoadingCallback","description":"<p>Name of a function to call while file\n is loading. That function will\n receive percentage loaded\n (between 0 and 1) as a\n parameter.</p>\n","type":"Function","optional":true}],"return":{"description":"p5.SoundFile Object","type":"Object"},"example":[" \n<div><code>\n\nfunction preload() {\n mySound = loadSound('assets/doorbell.mp3');\n}\n\nfunction setup() {\n mySound.setVolume(0.1);\n mySound.play();\n}\n \n </code></div>"]},"p5.Amplitude":{"name":"p5.Amplitude","shortname":"p5.Amplitude","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.sound","submodule":"p5.sound","namespace":"","file":"lib/addons/p5.sound.js","line":2159,"description":"<p>Amplitude measures volume between 0.0 and 1.0.\nListens to all p5sound by default, or use setInput()\nto listen to a specific sound source. Accepts an optional\nsmoothing value, which defaults to 0.</p>\n","is_constructor":1,"params":[{"name":"smoothing","description":"<p>between 0.0 and .999 to smooth\n amplitude readings (defaults to 0)</p>\n","type":"Number","optional":true}],"return":{"description":"Amplitude Object","type":"Object"},"example":["\n<div><code>\nvar sound, amplitude, cnv;\n\nfunction preload(){\n sound = loadSound('assets/beat.mp3');\n}\nfunction setup() {\n cnv = createCanvas(100,100);\n amplitude = new p5.Amplitude();\n\n // start / stop the sound when canvas is clicked\n cnv.mouseClicked(function() {\n if (sound.isPlaying() ){\n sound.stop();\n } else {\n sound.play();\n }\n });\n}\nfunction draw() {\n background(0);\n fill(255);\n var level = amplitude.getLevel();\n var size = map(level, 0, 1, 0, 200);\n ellipse(width/2, height/2, size, size);\n}\n\n</code></div>"]},"p5.FFT":{"name":"p5.FFT","shortname":"p5.FFT","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.sound","submodule":"p5.sound","namespace":"","file":"lib/addons/p5.sound.js","line":2432,"description":"<p>FFT (Fast Fourier Transform) is an analysis algorithm that\nisolates individual\n<a href=\"https://en.wikipedia.org/wiki/Audio_frequency\">\naudio frequencies</a> within a waveform.</p>\n\n<p>Once instantiated, a p5.FFT object can return an array based on\ntwo types of analyses: <br> • <code>FFT.waveform()</code> computes\namplitude values along the time domain. The array indices correspond\nto samples across a brief moment in time. Each value represents\namplitude of the waveform at that sample of time.<br>\n• <code>FFT.analyze() </code> computes amplitude values along the\nfrequency domain. The array indices correspond to frequencies (i.e.\npitches), from the lowest to the highest that humans can hear. Each\nvalue represents amplitude at that slice of the frequency spectrum.\nUse with <code>getEnergy()</code> to measure amplitude at specific\nfrequencies, or within a range of frequencies. </p>\n\n<p>FFT analyzes a very short snapshot of sound called a sample\nbuffer. It returns an array of amplitude measurements, referred\nto as <code>bins</code>. The array is 1024 bins long by default.\nYou can change the bin array length, but it must be a power of 2\nbetween 16 and 1024 in order for the FFT algorithm to function\ncorrectly. The actual size of the FFT buffer is twice the \nnumber of bins, so given a standard sample rate, the buffer is\n2048/44100 seconds long.</p>","is_constructor":1,"params":[{"name":"smoothing","description":"<p>Smooth results of Freq Spectrum.\n 0.0 &lt; smoothing &lt; 1.0.\n Defaults to 0.8.</p>\n","type":"Number","optional":true},{"name":"bins","description":"<p>Length of resulting array.\n Must be a power of two between\n 16 and 1024. Defaults to 1024.</p>\n","type":"Number","optional":true}],"return":{"description":"FFT Object","type":"Object"},"example":["\n<div><code>\nfunction preload(){\n sound = loadSound('assets/Damscray_DancingTiger.mp3');\n}\n\nfunction setup(){\n var cnv = createCanvas(100,100);\n cnv.mouseClicked(togglePlay);\n fft = new p5.FFT();\n sound.amp(0.2);\n}\n\nfunction draw(){\n background(0);\n\n var spectrum = fft.analyze(); \n noStroke();\n fill(0,255,0); // spectrum is green\n for (var i = 0; i< spectrum.length; i++){\n var x = map(i, 0, spectrum.length, 0, width);\n var h = -height + map(spectrum[i], 0, 255, height, 0);\n rect(x, height, width / spectrum.length, h )\n }\n\n var waveform = fft.waveform();\n noFill();\n beginShape();\n stroke(255,0,0); // waveform is red\n strokeWeight(1);\n for (var i = 0; i< waveform.length; i++){\n var x = map(i, 0, waveform.length, 0, width);\n var y = map( waveform[i], -1, 1, 0, height);\n vertex(x,y);\n }\n endShape();\n\n text('click to play/pause', 4, 10);\n}\n\n// fade sound if mouse is over canvas\nfunction togglePlay() {\n if (sound.isPlaying()) {\n sound.pause();\n } else {\n sound.loop();\n }\n}\n</code></div>"]},"p5.Signal":{"name":"p5.Signal","shortname":"p5.Signal","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.sound","submodule":"p5.sound","namespace":"","file":"lib/addons/p5.sound.js","line":4161,"description":"<p>p5.Signal is a constant audio-rate signal used by p5.Oscillator\nand p5.Envelope for modulation math.</p>\n\n<p>This is necessary because Web Audio is processed on a seprate clock.\nFor example, the p5 draw loop runs about 60 times per second. But\nthe audio clock must process samples 44100 times per second. If we\nwant to add a value to each of those samples, we can&#39;t do it in the\ndraw loop, but we can do it by adding a constant-rate audio signal.</p.\n\n<p>This class mostly functions behind the scenes in p5.sound, and returns\na Tone.Signal from the Tone.js library by Yotam Mann.\nIf you want to work directly with audio signals for modular\nsynthesis, check out\n<a href='http://bit.ly/1oIoEng' target=_'blank'>tone.js.</a></p>","is_constructor":1,"return":{"description":"A Signal object from the Tone.js library","type":"Tone.Signal"},"example":["\n<div><code>\nfunction setup() {\n carrier = new p5.Oscillator('sine');\n carrier.amp(1); // set amplitude\n carrier.freq(220); // set frequency\n carrier.start(); // start oscillating\n \n modulator = new p5.Oscillator('sawtooth');\n modulator.disconnect();\n modulator.amp(1);\n modulator.freq(4);\n modulator.start();\n\n // Modulator's default amplitude range is -1 to 1.\n // Multiply it by -200, so the range is -200 to 200\n // then add 220 so the range is 20 to 420\n carrier.freq( modulator.mult(-200).add(220) );\n}\n</code></div>"]},"p5.Oscillator":{"name":"p5.Oscillator","shortname":"p5.Oscillator","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.sound","submodule":"p5.sound","namespace":"","file":"lib/addons/p5.sound.js","line":4307,"description":"<p>Creates a signal that oscillates between -1.0 and 1.0.\nBy default, the oscillation takes the form of a sinusoidal\nshape (&#39;sine&#39;). Additional types include &#39;triangle&#39;,\n&#39;sawtooth&#39; and &#39;square&#39;. The frequency defaults to\n440 oscillations per second (440Hz, equal to the pitch of an\n&#39;A&#39; note).</p> \n\n<p>Set the type of oscillation with setType(), or by creating a\nspecific oscillator.</p> For example:\n<code>new p5.SinOsc(freq)</code>\n<code>new p5.TriOsc(freq)</code>\n<code>new p5.SqrOsc(freq)</code>\n<code>new p5.SawOsc(freq)</code>.\n</p>","is_constructor":1,"params":[{"name":"freq","description":"<p>frequency defaults to 440Hz</p>\n","type":"Number","optional":true},{"name":"type","description":"<p>type of oscillator. Options:\n &#39;sine&#39; (default), &#39;triangle&#39;,\n &#39;sawtooth&#39;, &#39;square&#39;</p>\n","type":"String","optional":true}],"return":{"description":"Oscillator object","type":"Object"},"example":["\n<div><code>\nvar osc;\nvar playing = false;\n\nfunction setup() {\n backgroundColor = color(255,0,255);\n textAlign(CENTER);\n \n osc = new p5.Oscillator();\n osc.setType('sine');\n osc.freq(240);\n osc.amp(0);\n osc.start();\n}\n\nfunction draw() {\n background(backgroundColor)\n text('click to play', width/2, height/2);\n}\n\nfunction mouseClicked() {\n if (mouseX > 0 && mouseX < width && mouseY < height && mouseY > 0) {\n if (!playing) {\n // ramp amplitude to 0.5 over 0.1 seconds\n osc.amp(0.5, 0.05);\n playing = true;\n backgroundColor = color(0,255,255);\n } else {\n // ramp amplitude to 0 over 0.5 seconds\n osc.amp(0, 0.5);\n playing = false;\n backgroundColor = color(255,0,255);\n }\n }\n}\n</code> </div>"]},"p5.Env":{"name":"p5.Env","shortname":"p5.Env","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.sound","submodule":"p5.sound","namespace":"","file":"lib/addons/p5.sound.js","line":5163,"description":"<p>Envelopes are pre-defined amplitude distribution over time.\nTypically, envelopes are used to control the output volume\nof an object, a series of fades referred to as Attack, Decay,\nSustain and Release (\n<a href=\"https://upload.wikimedia.org/wikipedia/commons/e/ea/ADSR_parameter.svg\">ADSR</a>\n). Envelopes can also control other Web Audio Parameters—for example, a p5.Env can \ncontrol an Oscillator&#39;s frequency like this: <code>osc.freq(env)</code>.</p>\n<p>Use <code><a href=\"#/p5.Env/setRange\">setRange</a></code> to change the attack/release level.\nUse <code><a href=\"#/p5.Env/setADSR\">setADSR</a></code> to change attackTime, decayTime, sustainPercent and releaseTime.</p>\n<p>Use the <code><a href=\"#/p5.Env/play\">play</a></code> method to play the entire envelope,\nthe <code><a href=\"#/p5.Env/ramp\">ramp</a></code> method for a pingable trigger,\nor <code><a href=\"#/p5.Env/triggerAttack\">triggerAttack</a></code>/\n<code><a href=\"#/p5.Env/triggerRelease\">triggerRelease</a></code> to trigger noteOn/noteOff.</p>","is_constructor":1,"example":["\n<div><code>\nvar attackLevel = 1.0;\nvar releaseLevel = 0;\n\nvar attackTime = 0.001\nvar decayTime = 0.2;\nvar susPercent = 0.2;\nvar releaseTime = 0.5;\n\nvar env, triOsc;\n\nfunction setup() {\n var cnv = createCanvas(100, 100);\n\n textAlign(CENTER);\n text('click to play', width/2, height/2);\n\n env = new p5.Env();\n env.setADSR(attackTime, decayTime, susPercent, releaseTime);\n env.setRange(attackLevel, releaseLevel);\n\n triOsc = new p5.Oscillator('triangle');\n triOsc.amp(env);\n triOsc.start();\n triOsc.freq(220);\n\n cnv.mousePressed(playEnv);\n}\n\nfunction playEnv(){\n env.play();\n}\n</code></div>"]},"p5.Pulse":{"name":"p5.Pulse","shortname":"p5.Pulse","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.sound","submodule":"p5.sound","namespace":"","file":"lib/addons/p5.sound.js","line":5926,"description":"<p>Creates a Pulse object, an oscillator that implements\nPulse Width Modulation.\nThe pulse is created with two oscillators.\nAccepts a parameter for frequency, and to set the\nwidth between the pulses. See <a href=\"\nhttp://p5js.org/reference/#/p5.Oscillator\">\n<code>p5.Oscillator</code> for a full list of methods.</p>\n","is_constructor":1,"params":[{"name":"freq","description":"<p>Frequency in oscillations per second (Hz)</p>\n","type":"Number","optional":true},{"name":"w","description":"<p>Width between the pulses (0 to 1.0,\n defaults to 0)</p>\n","type":"Number","optional":true}],"example":["\n<div><code>\nvar pulse;\nfunction setup() {\n background(0);\n \n // Create and start the pulse wave oscillator\n pulse = new p5.Pulse();\n pulse.amp(0.5);\n pulse.freq(220);\n pulse.start();\n}\n\nfunction draw() {\n var w = map(mouseX, 0, width, 0, 1);\n w = constrain(w, 0, 1);\n pulse.width(w)\n}\n</code></div>"]},"p5.Noise":{"name":"p5.Noise","shortname":"p5.Noise","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.sound","submodule":"p5.sound","namespace":"","file":"lib/addons/p5.sound.js","line":6102,"description":"<p>Noise is a type of oscillator that generates a buffer with random values.</p>\n","is_constructor":1,"params":[{"name":"type","description":"<p>Type of noise can be &#39;white&#39; (default),\n &#39;brown&#39; or &#39;pink&#39;.</p>\n","type":"String"}],"return":{"description":"Noise Object","type":"Object"}},"p5.AudioIn":{"name":"p5.AudioIn","shortname":"p5.AudioIn","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.sound","submodule":"p5.sound","namespace":"","file":"lib/addons/p5.sound.js","line":6281,"description":"<p>Get audio from an input, i.e. your computer&#39;s microphone.</p>\n\n<p>Turn the mic on/off with the start() and stop() methods. When the mic\nis on, its volume can be measured with getLevel or by connecting an\nFFT object.</p>\n\n<p>If you want to hear the AudioIn, use the .connect() method. \nAudioIn does not connect to p5.sound output by default to prevent\nfeedback.</p> \n\n<p><em>Note: This uses the <a href=\"http://caniuse.com/stream\">getUserMedia/\nStream</a> API, which is not supported by certain browsers.</em></p>","is_constructor":1,"return":{"description":"AudioIn","type":"Object"},"example":["\n<div><code>\nvar mic;\nfunction setup(){\n mic = new p5.AudioIn()\n mic.start();\n}\nfunction draw(){\n background(0);\n micLevel = mic.getLevel();\n ellipse(width/2, constrain(height-micLevel*height*5, 0, height), 10, 10);\n}\n</code></div>"]},"p5.Filter":{"name":"p5.Filter","shortname":"p5.Filter","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.sound","submodule":"p5.sound","namespace":"","file":"lib/addons/p5.sound.js","line":6593,"description":"<p>A p5.Filter uses a Web Audio Biquad Filter to filter\nthe frequency response of an input source. Inheriting\nclasses include:<br/></p>\n<ul>\n<li><code>p5.LowPass</code> - allows frequencies below\nthe cutoff frequency to pass through, and attenuates\nfrequencies above the cutoff.<br/></li>\n<li><code>p5.HighPass</code> - the opposite of a lowpass\nfilter. <br/></li>\n<li><code>p5.BandPass</code> - allows a range of\nfrequencies to pass through and attenuates the frequencies\nbelow and above this frequency range.<br/></li>\n</ul>\n<p>The <code>.res()</code> method controls either width of the\nbandpass, or resonance of the low/highpass cutoff frequency.</p>\n","is_constructor":1,"params":[{"name":"type","description":"<p>&#39;lowpass&#39; (default), &#39;highpass&#39;, &#39;bandpass&#39;</p>\n","type":"[String]"}],"return":{"description":"p5.Filter","type":"Object"},"example":["\n<div><code>\nvar fft, noise, filter;\n\nfunction setup() {\n fill(255, 40, 255);\n\n filter = new p5.BandPass();\n\n noise = new p5.Noise();\n // disconnect unfiltered noise,\n // and connect to filter\n noise.disconnect();\n noise.connect(filter);\n noise.start();\n\n fft = new p5.FFT();\n}\n\nfunction draw() {\n background(30);\n\n // set the BandPass frequency based on mouseX\n var freq = map(mouseX, 0, width, 20, 10000);\n filter.freq(freq);\n // give the filter a narrow band (lower res = wider bandpass)\n filter.res(50);\n\n // draw filtered spectrum\n var spectrum = fft.analyze();\n noStroke();\n for (var i = 0; i < spectrum.length; i++) {\n var x = map(i, 0, spectrum.length, 0, width);\n var h = -height + map(spectrum[i], 0, 255, height, 0);\n rect(x, height, width/spectrum.length, h);\n }\n \n isMouseOverCanvas();\n}\n\nfunction isMouseOverCanvas() {\n var mX = mouseX, mY = mouseY;\n if (mX > 0 && mX < width && mY < height && mY > 0) {\n noise.amp(0.5, 0.2);\n } else {\n noise.amp(0, 0.2);\n }\n}\n</code></div>"]},"p5.Delay":{"name":"p5.Delay","shortname":"p5.Delay","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.sound","submodule":"p5.sound","namespace":"","file":"lib/addons/p5.sound.js","line":6866,"description":"<p>Delay is an echo effect. It processes an existing sound source,\nand outputs a delayed version of that sound. The p5.Delay can\nproduce different effects depending on the delayTime, feedback,\nfilter, and type. In the example below, a feedback of 0.5 will\nproduce a looping delay that decreases in volume by\n50% each repeat. A filter will cut out the high frequencies so\nthat the delay does not sound as piercing as the original source.</p>\n","is_constructor":1,"return":{"description":"Returns a p5.Delay object","type":"Object"},"example":["\n<div><code>\nvar noise, env, delay;\n\nfunction setup() {\n background(0);\n noStroke();\n fill(255);\n textAlign(CENTER);\n text('click to play', width/2, height/2);\n \n noise = new p5.Noise('brown');\n noise.amp(0);\n noise.start();\n \n delay = new p5.Delay();\n\n // delay.process() accepts 4 parameters:\n // source, delayTime, feedback, filter frequency\n // play with these numbers!!\n delay.process(noise, .12, .7, 2300);\n \n // play the noise with an envelope,\n // a series of fades ( time / value pairs )\n env = new p5.Env(.01, 0.2, .2, .1);\n}\n\n// mouseClick triggers envelope\nfunction mouseClicked() {\n // is mouse over canvas?\n if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n env.play(noise);\n }\n}\n</code></div>"]},"p5.Reverb":{"name":"p5.Reverb","shortname":"p5.Reverb","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.sound","submodule":"p5.sound","namespace":"","file":"lib/addons/p5.sound.js","line":7158,"description":"<p>Reverb adds depth to a sound through a large number of decaying\nechoes. It creates the perception that sound is occurring in a\nphysical space. The p5.Reverb has paramters for Time (how long does the\nreverb last) and decayRate (how much the sound decays with each echo)\nthat can be set with the .set() or .process() methods. The p5.Convolver\nextends p5.Reverb allowing you to recreate the sound of actual physical\nspaces through convolution.</p>\n","is_constructor":1,"example":["\n<div><code>\nvar soundFile, reverb;\nfunction preload() {\n soundFile = loadSound('assets/Damscray_DancingTiger.mp3');\n}\n\nfunction setup() {\n reverb = new p5.Reverb();\n soundFile.disconnect(); // so we'll only hear reverb...\n\n // connect soundFile to reverb, process w/\n // 3 second reverbTime, decayRate of 2%\n reverb.process(soundFile, 3, 2);\n soundFile.play();\n}\n</code></div>"]},"p5.Convolver":{"name":"p5.Convolver","shortname":"p5.Convolver","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.sound","submodule":"p5.sound","namespace":"","file":"lib/addons/p5.sound.js","line":7340,"description":"<p>p5.Convolver extends p5.Reverb. It can emulate the sound of real\nphysical spaces through a process called <a href=\"\nhttps://en.wikipedia.org/wiki/Convolution_reverb#Real_space_simulation\">\nconvolution</a>.</p>\n\n<p>Convolution multiplies any audio input by an &quot;impulse response&quot;\nto simulate the dispersion of sound over time. The impulse response is\ngenerated from an audio file that you provide. One way to\ngenerate an impulse response is to pop a balloon in a reverberant space\nand record the echo. Convolution can also be used to experiment with\nsound.</p>\n\n<p>Use the method <code>createConvolution(path)</code> to instantiate a\np5.Convolver with a path to your impulse response audio file.</p>","is_constructor":1,"params":[{"name":"path","description":"<p>path to a sound file</p>\n","type":"String"},{"name":"callback","description":"<p>function to call when loading succeeds</p>\n","type":"Function","optional":true},{"name":"errorCallback","description":"<p>function to call if loading fails.\n This function will receive an error or\n XMLHttpRequest object with information\n about what went wrong.</p>\n","type":"Function","optional":true}],"example":["\n<div><code>\nvar cVerb, sound;\nfunction preload() {\n // We have both MP3 and OGG versions of all sound assets\n soundFormats('ogg', 'mp3');\n \n // Try replacing 'bx-spring' with other soundfiles like\n // 'concrete-tunnel' 'small-plate' 'drum' 'beatbox'\n cVerb = createConvolver('assets/bx-spring.mp3');\n\n // Try replacing 'Damscray_DancingTiger' with\n // 'beat', 'doorbell', lucky_dragons_-_power_melody'\n sound = loadSound('assets/Damscray_DancingTiger.mp3');\n}\n\nfunction setup() {\n // disconnect from master output...\n sound.disconnect();\n \n // ...and process with cVerb\n // so that we only hear the convolution\n cVerb.process(sound);\n \n sound.play();\n}\n</code></div>"]},"p5.Phrase":{"name":"p5.Phrase","shortname":"p5.Phrase","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.sound","submodule":"p5.sound","namespace":"","file":"lib/addons/p5.sound.js","line":7923,"description":"<p>A phrase is a pattern of musical events over time, i.e.\na series of notes and rests.</p>\n\n<p>Phrases must be added to a p5.Part for playback, and\neach part can play multiple phrases at the same time.\nFor example, one Phrase might be a kick drum, another\ncould be a snare, and another could be the bassline.</p>\n\n<p>The first parameter is a name so that the phrase can be\nmodified or deleted later. The callback is a a function that\nthis phrase will call at every step—for example it might be\ncalled <code>playNote(value){}</code>. The array determines\nwhich value is passed into the callback at each step of the\nphrase. It can be numbers, an object with multiple numbers,\nor a zero (0) indicates a rest so the callback won&#39;t be called).</p>","is_constructor":1,"params":[{"name":"name","description":"<p>Name so that you can access the Phrase.</p>\n","type":"String"},{"name":"callback","description":"<p>The name of a function that this phrase\n will call. Typically it will play a sound,\n and accept two parameters: a time at which\n to play the sound (in seconds from now),\n and a value from the sequence array. The\n time should be passed into the play() or\n start() method to ensure precision.</p>\n","type":"Function"},{"name":"sequence","description":"<p>Array of values to pass into the callback\n at each step of the phrase.</p>\n","type":"Array"}],"example":["\n<div><code>\nvar mySound, myPhrase, myPart;\nvar pattern = [1,0,0,2,0,2,0,0];\nvar msg = 'click to play';\n\nfunction preload() {\n mySound = loadSound('assets/beatbox.mp3');\n}\n\nfunction setup() {\n noStroke();\n fill(255);\n textAlign(CENTER);\n masterVolume(0.1);\n \n myPhrase = new p5.Phrase('bbox', makeSound, pattern);\n myPart = new p5.Part();\n myPart.addPhrase(myPhrase);\n myPart.setBPM(60);\n}\n\nfunction draw() {\n background(0);\n text(msg, width/2, height/2);\n}\n\nfunction makeSound(time, playbackRate) {\n mySound.rate(playbackRate);\n mySound.play(time);\n}\n\nfunction mouseClicked() {\n if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n myPart.start();\n msg = 'playing pattern';\n }\n}\n\n</code></div>"]},"p5.Part":{"name":"p5.Part","shortname":"p5.Part","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.sound","submodule":"p5.sound","namespace":"","file":"lib/addons/p5.sound.js","line":8009,"description":"<p>A p5.Part plays back one or more p5.Phrases. Instantiate a part\nwith steps and tatums. By default, each step represents 1/16th note.</p>\n\n<p>See p5.Phrase for more about musical timing.</p>","is_constructor":1,"params":[{"name":"steps","description":"<p>Steps in the part</p>\n","type":"Number","optional":true},{"name":"tatums","description":"<p>Divisions of a beat (default is 1/16, a quarter note)</p>\n","type":"Number","optional":true}],"example":["\n<div><code>\nvar box, drum, myPart;\nvar boxPat = [1,0,0,2,0,2,0,0];\nvar drumPat = [0,1,1,0,2,0,1,0];\nvar msg = 'click to play';\n\nfunction preload() {\n box = loadSound('assets/beatbox.mp3');\n drum = loadSound('assets/drum.mp3');\n}\n\nfunction setup() {\n noStroke();\n fill(255);\n textAlign(CENTER);\n masterVolume(0.1);\n\n var boxPhrase = new p5.Phrase('box', playBox, boxPat);\n var drumPhrase = new p5.Phrase('drum', playDrum, drumPat);\n myPart = new p5.Part();\n myPart.addPhrase(boxPhrase);\n myPart.addPhrase(drumPhrase);\n myPart.setBPM(60);\n masterVolume(0.1);\n}\n\nfunction draw() {\n background(0);\n text(msg, width/2, height/2);\n}\n\nfunction playBox(time, playbackRate) {\n box.rate(playbackRate);\n box.play(time);\n}\n\nfunction playDrum(time, playbackRate) {\n drum.rate(playbackRate);\n drum.play(time);\n}\n\nfunction mouseClicked() {\n if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n myPart.start();\n msg = 'playing part';\n }\n}\n</code></div>"]},"p5.Score":{"name":"p5.Score","shortname":"p5.Score","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.sound","submodule":"p5.sound","namespace":"","file":"lib/addons/p5.sound.js","line":8267,"description":"<p>A Score consists of a series of Parts. The parts will\nbe played back in order. For example, you could have an\nA part, a B part, and a C part, and play them back in this order\n<code>new p5.Score(a, a, b, a, c)</code></p>\n","is_constructor":1,"params":[{"name":"part(s)","description":"<p>One or multiple parts, to be played in sequence.</p>\n","type":"p5.Part"}],"return":{"description":"","type":"p5.Score"}},"p5.SoundRecorder":{"name":"p5.SoundRecorder","shortname":"p5.SoundRecorder","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.sound","submodule":"p5.sound","namespace":"","file":"lib/addons/p5.sound.js","line":8391,"description":"<p>Record sounds for playback and/or to save as a .wav file.\nThe p5.SoundRecorder records all sound output from your sketch,\nor can be assigned a specific source with setInput().</p>\n<p>The record() method accepts a p5.SoundFile as a parameter.\nWhen playback is stopped (either after the given amount of time,\nor with the stop() method), the p5.SoundRecorder will send its\nrecording to that p5.SoundFile for playback.</p>","is_constructor":1,"example":["\n<div><code>\nvar mic, recorder, soundFile;\nvar state = 0;\n\nfunction setup() {\n background(200);\n // create an audio in\n mic = new p5.AudioIn();\n \n // prompts user to enable their browser mic\n mic.start();\n \n // create a sound recorder\n recorder = new p5.SoundRecorder();\n \n // connect the mic to the recorder\n recorder.setInput(mic);\n \n // this sound file will be used to\n // playback & save the recording\n soundFile = new p5.SoundFile();\n\n text('keyPress to record', 20, 20);\n}\n\nfunction keyPressed() {\n // make sure user enabled the mic\n if (state === 0 && mic.enabled) {\n \n // record to our p5.SoundFile\n recorder.record(soundFile);\n \n background(255,0,0);\n text('Recording!', 20, 20);\n state++;\n }\n else if (state === 1) {\n background(0,255,0);\n\n // stop recorder and\n // send result to soundFile\n recorder.stop(); \n \n text('Stopped', 20, 20);\n state++;\n }\n \n else if (state === 2) {\n soundFile.play(); // play the result!\n save(soundFile, 'mySound.wav');\n state++;\n }\n}\n</div></code>"]},"p5.PeakDetect":{"name":"p5.PeakDetect","shortname":"p5.PeakDetect","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.sound","submodule":"p5.sound","namespace":"","file":"lib/addons/p5.sound.js","line":8675,"description":"<p>PeakDetect works in conjunction with p5.FFT to\nlook for onsets in some or all of the frequency spectrum.\n</p>\n<p>\nTo use p5.PeakDetect, call <code>update</code> in the draw loop\nand pass in a p5.FFT object.\n</p>\n<p>\nYou can listen for a specific part of the frequency spectrum by\nsetting the range between <code>freq1</code> and <code>freq2</code>.\n</p>\n\n<p><code>threshold</code> is the threshold for detecting a peak,\nscaled between 0 and 1. It is logarithmic, so 0.1 is half as loud\nas 1.0.</p>\n\n<p>\nThe update method is meant to be run in the draw loop, and\n<b>frames</b> determines how many loops must pass before\nanother peak can be detected.\nFor example, if the frameRate() = 60, you could detect the beat of a\n120 beat-per-minute song with this equation:\n<code> framesPerPeak = 60 / (estimatedBPM / 60 );</code>\n</p>\n\n<p>\nBased on example contribtued by @b2renger, and a simple beat detection\nexplanation by <a href=\"a\nhref=&quot;http://www.airtightinteractive.com/2013/10/making-audio-reactive-visuals/&quot;\ntarget=&quot;_blank&quot;\">a\nhref=&quot;http://www.airtightinteractive.com/2013/10/making-audio-reactive-visuals/&quot;\ntarget=&quot;_blank&quot;</a>Felix Turner</a>.\n</p>","is_constructor":1,"params":[{"name":"freq1","description":"<p>lowFrequency - defaults to 20Hz</p>\n","type":"Number","optional":true},{"name":"freq2","description":"<p>highFrequency - defaults to 20000 Hz</p>\n","type":"Number","optional":true},{"name":"threshold","description":"<p>Threshold for detecting a beat between 0 and 1\n scaled logarithmically where 0.1 is 1/2 the loudness\n of 1.0. Defaults to 0.35.</p>\n","type":"Number","optional":true},{"name":"framesPerPeak","description":"<p>Defaults to 20.</p>\n","type":"Number","optional":true}],"example":["\n<div><code>\n\nvar cnv, soundFile, fft, peakDetect;\nvar ellipseWidth = 10;\n\nfunction setup() {\n background(0);\n noStroke();\n fill(255);\n textAlign(CENTER);\n\n soundFile = loadSound('assets/beat.mp3');\n\n // p5.PeakDetect requires a p5.FFT\n fft = new p5.FFT();\n peakDetect = new p5.PeakDetect();\n\n}\n\nfunction draw() {\n background(0);\n text('click to play/pause', width/2, height/2);\n\n // peakDetect accepts an fft post-analysis\n fft.analyze();\n peakDetect.update(fft);\n\n if ( peakDetect.isDetected ) {\n ellipseWidth = 50;\n } else {\n ellipseWidth *= 0.95;\n }\n\n ellipse(width/2, height/2, ellipseWidth, ellipseWidth);\n}\n\n// toggle play/stop when canvas is clicked\nfunction mouseClicked() {\n if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n if (soundFile.isPlaying() ) {\n soundFile.stop();\n } else {\n soundFile.play();\n }\n }\n}\n</code></div>"]},"p5.Gain":{"name":"p5.Gain","shortname":"p5.Gain","classitems":[],"plugins":[],"extensions":[],"plugin_for":[],"extension_for":[],"module":"p5.sound","submodule":"p5.sound","namespace":"","file":"lib/addons/p5.sound.js","line":8897,"description":"<p>A gain node is usefull to set the relative volume of sound.\nIt&#39;s typically used to build mixers.</p>\n","is_constructor":1,"example":["\n<div><code>\n\n // load two soundfile and crossfade beetween them\n var sound1,sound2;\n var gain1, gain2, gain3;\n \n function preload(){\n soundFormats('ogg', 'mp3');\n sound1 = loadSound('../_files/Damscray_-_Dancing_Tiger_01');\n sound2 = loadSound('../_files/beat.mp3');\n }\n\n function setup() {\n createCanvas(400,200);\n\n // create a 'master' gain to which we will connect both soundfiles\n gain3 = new p5.Gain();\n gain3.connect();\n\n // setup first sound for playing\n sound1.rate(1);\n sound1.loop();\n sound1.disconnect(); // diconnect from p5 output\n\n gain1 = new p5.Gain(); // setup a gain node\n gain1.setInput(sound1); // connect the first sound to its input\n gain1.connect(gain3); // connect its output to the 'master'\n\n sound2.rate(1);\n sound2.disconnect();\n sound2.loop();\n\n gain2 = new p5.Gain();\n gain2.setInput(sound2);\n gain2.connect(gain3);\n\n }\n\n function draw(){\n background(180);\n\n // calculate the horizontal distance beetween the mouse and the right of the screen\n var d = dist(mouseX,0,width,0);\n\n // map the horizontal position of the mouse to values useable for volume control of sound1\n var vol1 = map(mouseX,0,width,0,1); \n var vol2 = 1-vol1; // when sound1 is loud, sound2 is quiet and vice versa\n\n gain1.amp(vol1,0.5,0);\n gain2.amp(vol2,0.5,0);\n\n // map the vertical position of the mouse to values useable for 'master volume control'\n var vol3 = map(mouseY,0,height,0,1); \n gain3.amp(vol3,0.5,0);\n }\n</code></div>\n"]}},"classitems":[{"file":"src/color/color_conversion.js","line":1,"description":"<p>module Conversion\nsubmodule Color Conversion</p>\n","requires":["core"],"class":"p5"},{"file":"src/color/color_conversion.js","line":10,"description":"<p>Conversions adapted from <a href=\"http://www.easyrgb.com/math.html\">http://www.easyrgb.com/math.html</a>.</p>\n<p>In these functions, hue is always in the range [0,1); all other components\nare in the range [0,1]. &#39;Brightness&#39; and &#39;value&#39; are used interchangeably.</p>\n","class":"p5"},{"file":"src/color/color_conversion.js","line":20,"description":"<p>Convert an HSBA array to HSLA.</p>\n","class":"p5"},{"file":"src/color/color_conversion.js","line":46,"description":"<p>Convert an HSBA array to RGBA.</p>\n","class":"p5"},{"file":"src/color/color_conversion.js","line":95,"description":"<p>Convert an HSLA array to HSBA.</p>\n","class":"p5"},{"file":"src/color/color_conversion.js","line":118,"description":"<p>Convert an HSLA array to RGBA.</p>\n<p>We need to change basis from HSLA to something that can be more easily be\nprojected onto RGBA. We will choose hue and brightness as our first two\ncomponents, and pick a convenient third one (&#39;zest&#39;) so that we don&#39;t need\nto calculate formal HSBA saturation.</p>\n","class":"p5"},{"file":"src/color/color_conversion.js","line":176,"description":"<p>Convert an RGBA array to HSBA.</p>\n","class":"p5"},{"file":"src/color/color_conversion.js","line":211,"description":"<p>Convert an RGBA array to HSLA.</p>\n","class":"p5"},{"file":"src/color/creating_reading.js","line":15,"description":"<p>Extracts the alpha value from a color or pixel array.</p>\n","itemtype":"method","name":"alpha","params":[{"name":"obj","description":"<p>p5.Color object or pixel array</p>\n","type":"Object"}],"example":["\n<div>\n<code>\nnoStroke();\nc = color(0, 126, 255, 102);\nfill(c);\nrect(15, 15, 35, 70);\nvalue = alpha(c); // Sets 'value' to 102\nfill(value);\nrect(50, 15, 35, 70);\n</code>\n</div>"],"class":"p5","module":"Color","submodule":"Creating & Reading"},{"file":"src/color/creating_reading.js","line":41,"description":"<p>Extracts the blue value from a color or pixel array.</p>\n","itemtype":"method","name":"blue","params":[{"name":"obj","description":"<p>p5.Color object or pixel array</p>\n","type":"Object"}],"example":["\n<div>\n<code>\nc = color(175, 100, 220); // Define color 'c'\nfill(c); // Use color variable 'c' as fill color\nrect(15, 20, 35, 60); // Draw left rectangle\n\nblueValue = blue(c); // Get blue in 'c'\nprintln(blueValue); // Prints \"220.0\"\nfill(0, 0, blueValue); // Use 'blueValue' in new fill\nrect(50, 20, 35, 60); // Draw right rectangle\n</code>\n</div>"],"class":"p5","module":"Color","submodule":"Creating & Reading"},{"file":"src/color/creating_reading.js","line":68,"description":"<p>Extracts the HSB brightness value from a color or pixel array.</p>\n","itemtype":"method","name":"brightness","params":[{"name":"color","description":"<p>p5.Color object or pixel array</p>\n","type":"Object"}],"example":["\n<div>\n<code>\nnoStroke();\ncolorMode(HSB, 255);\nc = color(0, 126, 255);\nfill(c);\nrect(15, 20, 35, 60);\nvalue = brightness(c); // Sets 'value' to 255\nfill(value);\nrect(50, 20, 35, 60);\n</code>\n</div>"],"class":"p5","module":"Color","submodule":"Creating & Reading"},{"file":"src/color/creating_reading.js","line":95,"description":"<p>Creates colors for storing in variables of the color datatype. The\nparameters are interpreted as RGB or HSB values depending on the\ncurrent colorMode(). The default mode is RGB values from 0 to 255\nand, therefore, the function call color(255, 204, 0) will return a\nbright yellow color.\n<br><br>\nNote that if only one value is provided to color(), it will be interpreted\nas a grayscale value. Add a second value, and it will be used for alpha\ntransparency. When three values are specified, they are interpreted as\neither RGB or HSB values. Adding a fourth value applies alpha\ntransparency. If a single string parameter is provided it will be\ninterpreted as a CSS-compatible color string.</p>\n<p>Colors are stored as Numbers or Arrays.</p>\n","itemtype":"method","name":"color","return":{"description":"resulting color","type":"Array"},"alt":"This is alt text for example 1.\nThis is alt text for example 2.\nThis is alt text for example 3.","example":["\n<div>\n<code>\nvar c = color(255, 204, 0); // Define color 'c'\nfill(c); // Use color variable 'c' as fill color\nnoStroke(); // Don't draw a stroke around shapes\nrect(30, 20, 55, 55); // Draw rectangle\n</code>\n</div>\n\n<div>\n<code>\nvar c = color(255, 204, 0); // Define color 'c'\nfill(c); // Use color variable 'c' as fill color\nnoStroke(); // Don't draw a stroke around shapes\nellipse(25, 25, 80, 80); // Draw left circle\n\n// Using only one value with color()\n// generates a grayscale value.\nvar c = color(65); // Update 'c' with grayscale value\nfill(c); // Use updated 'c' as fill color\nellipse(75, 75, 80, 80); // Draw right circle\n</code>\n</div>\n\n<div>\n<code>\n// Named SVG & CSS colors may be used,\nvar c = color('magenta');\nfill(c); // Use 'c' as fill color\nnoStroke(); // Don't draw a stroke around shapes\nrect(20, 20, 60, 60); // Draw rectangle\n</code>\n</div>\n\n<div>\n<code>\n// as can hex color codes:\nnoStroke(); // Don't draw a stroke around shapes\nvar c = color('#0f0');\nfill(c); // Use 'c' as fill color\nrect(0, 10, 45, 80); // Draw rectangle\n\nc = color('#00ff00');\nfill(c); // Use updated 'c' as fill color\nrect(55, 10, 45, 80); // Draw rectangle\n</code>\n</div>\n\n<div>\n<code>\n// RGB and RGBA color strings are also supported:\n// these all set to the same color (solid blue)\nvar c;\nnoStroke(); // Don't draw a stroke around shapes\nc = color('rgb(0,0,255)');\nfill(c); // Use 'c' as fill color\nrect(10, 10, 35, 35); // Draw rectangle\n\nc = color('rgb(0%, 0%, 100%)');\nfill(c); // Use updated 'c' as fill color\nrect(55, 10, 35, 35); // Draw rectangle\n\nc = color('rgba(0, 0, 255, 1)');\nfill(c); // Use updated 'c' as fill color\nrect(10, 55, 35, 35); // Draw rectangle\n\nc = color('rgba(0%, 0%, 100%, 1)');\nfill(c); // Use updated 'c' as fill color\nrect(55, 55, 35, 35); // Draw rectangle\n</code>\n</div>\n\n<div>\n<code>\n// HSL color is also supported and can be specified\n// by value\nvar c;\nnoStroke(); // Don't draw a stroke around shapes\nc = color('hsl(160, 100%, 50%)');\nfill(c); // Use 'c' as fill color\nrect(0, 10, 45, 80); // Draw rectangle\n\nc = color('hsla(160, 100%, 50%, 0.5)');\nfill(c); // Use updated 'c' as fill color\nrect(55, 10, 45, 80); // Draw rectangle\n</code>\n</div>\n\n<div>\n<code>\n// HSB color is also supported and can be specified\n// by value\nvar c;\nnoStroke(); // Don't draw a stroke around shapes\nc = color('hsb(160, 100%, 50%)');\nfill(c); // Use 'c' as fill color\nrect(0, 10, 45, 80); // Draw rectangle\n\nc = color('hsba(160, 100%, 50%, 0.5)');\nfill(c); // Use updated 'c' as fill color\nrect(55, 10, 45, 80); // Draw rectangle\n</code>\n</div>\n\n<div>\n<code>\nvar c; // Declare color 'c'\nnoStroke(); // Don't draw a stroke around shapes\n\n// If no colorMode is specified, then the\n// default of RGB with scale of 0-255 is used.\nc = color(50, 55, 100); // Create a color for 'c'\nfill(c); // Use color variable 'c' as fill color\nrect(0, 10, 45, 80); // Draw left rect\n\ncolorMode(HSB, 100); // Use HSB with scale of 0-100\nc = color(50, 55, 100); // Update 'c' with new color\nfill(c); // Use updated 'c' as fill color\nrect(55, 10, 45, 80); // Draw right rect\n</code>\n</div>"],"class":"p5","module":"Color","submodule":"Creating & Reading","overloads":[{"line":95,"params":[{"name":"gray","description":"<p>number specifying value between white\n and black.</p>\n","type":"Number|String"},{"name":"alpha","description":"<p>alpha value relative to current color range\n (default is 0-100)</p>\n","type":"Number","optional":true}]},{"line":246,"params":[{"name":"v1","description":"<p>red or hue value relative to\n the current color range, or a color string</p>\n","type":"Number|String"},{"name":"v2","description":"<p>green or saturation value\n relative to the current color range</p>\n","type":"Number"},{"name":"v3","description":"<p>blue or brightness value\n relative to the current color range</p>\n","type":"Number"},{"name":"alpha","description":"","type":"Number","optional":true}]}]},{"file":"src/color/creating_reading.js","line":275,"description":"<p>Extracts the green value from a color or pixel array.</p>\n","itemtype":"method","name":"green","params":[{"name":"color","description":"<p>p5.Color object or pixel array</p>\n","type":"Object"}],"example":["\n<div>\n<code>\nc = color(20, 75, 200); // Define color 'c'\nfill(c); // Use color variable 'c' as fill color\nrect(15, 20, 35, 60); // Draw left rectangle\n\ngreenValue = green(c); // Get green in 'c'\nprintln(greenValue); // Print \"75.0\"\nfill(0, greenValue, 0); // Use 'greenValue' in new fill\nrect(50, 20, 35, 60); // Draw right rectangle\n</code>\n</div>"],"class":"p5","module":"Color","submodule":"Creating & Reading"},{"file":"src/color/creating_reading.js","line":302,"description":"<p>Extracts the hue value from a color or pixel array.</p>\n<p>Hue exists in both HSB and HSL. This function will return the\nHSB-normalized hue when supplied with an HSB color object (or when supplied\nwith a pixel array while the color mode is HSB), but will default to the\nHSL-normalized hue otherwise. (The values will only be different if the\nmaximum hue setting for each system is different.)</p>\n","itemtype":"method","name":"hue","params":[{"name":"color","description":"<p>p5.Color object or pixel array</p>\n","type":"Object"}],"example":["\n<div>\n<code>\nnoStroke();\ncolorMode(HSB, 255);\nc = color(0, 126, 255);\nfill(c);\nrect(15, 20, 35, 60);\nvalue = hue(c); // Sets 'value' to \"0\"\nfill(value);\nrect(50, 20, 35, 60);\n</code>\n</div>"],"class":"p5","module":"Color","submodule":"Creating & Reading"},{"file":"src/color/creating_reading.js","line":335,"description":"<p>Blends two colors to find a third color somewhere between them. The amt\nparameter is the amount to interpolate between the two values where 0.0\nequal to the first color, 0.1 is very near the first color, 0.5 is halfway\nin between, etc. An amount below 0 will be treated as 0. Likewise, amounts\nabove 1 will be capped at 1. This is different from the behavior of lerp(),\nbut necessary because otherwise numbers outside the range will produce\nstrange and unexpected colors.\n<br><br>\nThe way that colours are interpolated depends on the current color mode.</p>\n","itemtype":"method","name":"lerpColor","params":[{"name":"c1","description":"<p>interpolate from this color</p>\n","type":"Array/Number"},{"name":"c2","description":"<p>interpolate to this color</p>\n","type":"Array/Number"},{"name":"amt","description":"<p>number between 0 and 1</p>\n","type":"Number"}],"return":{"description":"interpolated color","type":"Array/Number"},"example":["\n<div>\n<code>\ncolorMode(RGB);\nstroke(255);\nbackground(51);\nfrom = color(218, 165, 32);\nto = color(72, 61, 139);\ncolorMode(RGB); // Try changing to HSB.\ninterA = lerpColor(from, to, .33);\ninterB = lerpColor(from, to, .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);\n</code>\n</div>"],"class":"p5","module":"Color","submodule":"Creating & Reading"},{"file":"src/color/creating_reading.js","line":418,"description":"<p>Extracts the HSL lightness value from a color or pixel array.</p>\n","itemtype":"method","name":"lightness","params":[{"name":"color","description":"<p>p5.Color object or pixel array</p>\n","type":"Object"}],"example":["\n<div>\n<code>\nnoStroke();\ncolorMode(HSL);\nc = color(156, 100, 50, 1);\nfill(c);\nrect(15, 20, 35, 60);\nvalue = lightness(c); // Sets 'value' to 50\nfill(value);\nrect(50, 20, 35, 60);\n</code>\n</div>"],"class":"p5","module":"Color","submodule":"Creating & Reading"},{"file":"src/color/creating_reading.js","line":445,"description":"<p>Extracts the red value from a color or pixel array.</p>\n","itemtype":"method","name":"red","params":[{"name":"obj","description":"<p>p5.Color object or pixel array</p>\n","type":"Object"}],"example":["\n<div>\n<code>\nc = color(255, 204, 0); // Define color 'c'\nfill(c); // Use color variable 'c' as fill color\nrect(15, 20, 35, 60); // Draw left rectangle\n\nredValue = red(c); // Get red in 'c'\nprintln(redValue); // Print \"255.0\"\nfill(redValue, 0, 0); // Use 'redValue' in new fill\nrect(50, 20, 35, 60); // Draw right rectangle\n</code>\n</div>\n\n<div>\n<code>\ncolorMode(RGB, 255);\nvar c = color(127, 255, 0);\ncolorMode(RGB, 1);\nvar myColor = red(c);\nprintln(myColor);\n</code>\n</div>"],"class":"p5","module":"Color","submodule":"Creating & Reading"},{"file":"src/color/creating_reading.js","line":482,"description":"<p>Extracts the saturation value from a color or pixel array.</p>\n<p>Saturation is scaled differently in HSB and HSL. This function will return\nthe HSB saturation when supplied with an HSB color object (or when supplied\nwith a pixel array while the color mode is HSB), but will default to the\nHSL saturation otherwise.</p>\n","itemtype":"method","name":"saturation","params":[{"name":"color","description":"<p>p5.Color object or pixel array</p>\n","type":"Object"}],"example":["\n<div>\n<code>\nnoStroke();\ncolorMode(HSB, 255);\nc = color(0, 126, 255);\nfill(c);\nrect(15, 20, 35, 60);\nvalue = saturation(c); // Sets 'value' to 126\nfill(value);\nrect(50, 20, 35, 60);\n</code>\n</div>"],"class":"p5","module":"Color","submodule":"Creating & Reading"},{"file":"src/color/p5.Color.js","line":79,"description":"<p>Hue is the same in HSB and HSL, but the maximum value may be different.\nThis function will return the HSB-normalized saturation when supplied with\nan HSB color object, but will default to the HSL-normalized saturation\notherwise.</p>\n","class":"p5.Color","module":"Color","submodule":"Creating & Reading"},{"file":"src/color/p5.Color.js","line":110,"description":"<p>Saturation is scaled differently in HSB and HSL. This function will return\nthe HSB saturation when supplied with an HSB color object, but will default\nto the HSL saturation otherwise.</p>\n","class":"p5.Color","module":"Color","submodule":"Creating & Reading"},{"file":"src/color/p5.Color.js","line":129,"description":"<p>CSS named colors.</p>\n","class":"p5.Color","module":"Color","submodule":"Creating & Reading"},{"file":"src/color/p5.Color.js","line":282,"description":"<p>These regular expressions are used to build up the patterns for matching\nviable CSS color strings: fragmenting the regexes in this way increases the\nlegibility and comprehensibility of the code.</p>\n<p>Note that RGB values of .9 are not parsed by IE, but are supported here for\ncolor string consistency.</p>\n","class":"p5.Color","module":"Color","submodule":"Creating & Reading"},{"file":"src/color/p5.Color.js","line":295,"description":"<p>Full color string patterns. The capture groups are necessary.</p>\n","class":"p5.Color","module":"Color","submodule":"Creating & Reading"},{"file":"src/color/p5.Color.js","line":402,"description":"<p>For a number of different inputs, returns a color formatted as [r, g, b, a]\narrays, with each component normalized between 0 and 1.</p>\n","params":[{"name":"args","description":"<p>An &#39;array-like&#39; object that represents a list of\n arguments</p>\n","type":"Array-like"}],"return":{"description":"a color formatted as [r, g, b, a]\n Example:\n input ==> output\n g ==> [g, g, g, 255]\n g,a ==> [g, g, g, a]\n r, g, b ==> [r, g, b, 255]\n r, g, b, a ==> [r, g, b, a]\n [g] ==> [g, g, g, 255]\n [g, a] ==> [g, g, g, a]\n [r, g, b] ==> [r, g, b, 255]\n [r, g, b, a] ==> [r, g, b, a]","type":"Array"},"example":["\n<div>\n<code>\n// todo\n</code>\n</div>"],"class":"p5.Color","module":"Color","submodule":"Creating & Reading"},{"file":"src/color/p5.Color.js","line":572,"description":"<p>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.</p>\n","class":"p5.Color","module":"Color","submodule":"Creating & Reading"},{"file":"src/color/setting.js","line":15,"description":"<p>The background() function sets the color used for the background of the\np5.js canvas. The default background is light gray. This function is\ntypically used within draw() to clear the display window at the beginning\nof each frame, but it can be used inside setup() to set the background on\nthe first frame of animation or if the background need only be set once.</p>\n","itemtype":"method","name":"background","example":["\n<div>\n<code>\n// Grayscale integer value\nbackground(51);\n</code>\n</div>\n\n<div>\n<code>\n// R, G & B integer values\nbackground(255, 204, 0);\n</code>\n</div>\n\n<div>\n<code>\n// H, S & B integer values\ncolorMode(HSB);\nbackground(255, 204, 100);\n</code>\n</div>\n\n<div>\n<code>\n// Named SVG/CSS color string\nbackground('red');\n</code>\n</div>\n\n<div>\n<code>\n// three-digit hexadecimal RGB notation\nbackground('#fae');\n</code>\n</div>\n\n<div>\n<code>\n// six-digit hexadecimal RGB notation\nbackground('#222222');\n</code>\n</div>\n\n<div>\n<code>\n// integer RGB notation\nbackground('rgb(0,255,0)');\n</code>\n</div>\n\n<div>\n<code>\n// integer RGBA notation\nbackground('rgba(0,255,0, 0.25)');\n</code>\n</div>\n\n<div>\n<code>\n// percentage RGB notation\nbackground('rgb(100%,0%,10%)');\n</code>\n</div>\n\n<div>\n<code>\n// percentage RGBA notation\nbackground('rgba(100%,0%,100%,0.5)');\n</code>\n</div>\n\n<div>\n<code>\n// p5 Color object\nbackground(color(0, 0, 255));\n</code>\n</div>"],"class":"p5","module":"Color","submodule":"Setting","overloads":[{"line":15,"params":[{"name":"color","description":"<p>any value created by the color() function</p>\n","type":"p5.Color"},{"name":"a","description":"<p>opacity of the background relative to current\n color range (default is 0-100)</p>\n","type":"Number","optional":true}]},{"line":107,"params":[{"name":"colorstring","description":"<p>color string, possible formats include: integer\n rgb() or rgba(), percentage rgb() or rgba(),\n 3-digit hex, 6-digit hex</p>\n","type":"String"},{"name":"a","description":"","type":"Number","optional":true}]},{"line":115,"params":[{"name":"gray","description":"<p>specifies a value between white and black</p>\n","type":"Number"},{"name":"a","description":"","type":"Number","optional":true}]},{"line":121,"params":[{"name":"v1","description":"<p>red or hue value (depending on the current color\n mode)</p>\n","type":"Number"},{"name":"v2","description":"<p>green or saturation value (depending on the current\n color mode)</p>\n","type":"Number"},{"name":"v3","description":"<p>blue or brightness value (depending on the current\n color mode)</p>\n","type":"Number"},{"name":"a","description":"","type":"Number","optional":true}]},{"line":132,"params":[{"name":"image","description":"<p>image created with loadImage() or createImage(),\n to set as background\n (must be same size as the sketch window)</p>\n","type":"p5.Image"},{"name":"a","description":"","type":"Number","optional":true}]}]},{"file":"src/color/setting.js","line":148,"description":"<p>Clears the pixels within a buffer. This function only works on p5.Canvas\nobjects created with the createCanvas() function; it won&#39;t work with the\nmain display window. Unlike the main graphics context, pixels in\nadditional graphics areas created with createGraphics() can be entirely\nor partially transparent. This function clears everything to make all of\nthe pixels 100% transparent.</p>\n","itemtype":"method","name":"clear","example":["\n<div>\n<code>\n// Clear the screen on mouse press.\nfunction setup() {\n createCanvas(100, 100);\n}\n\nfunction draw() {\n ellipse(mouseX, mouseY, 20, 20);\n}\n\nfunction mousePressed() {\n clear();\n}\n</code>\n</div>"],"class":"p5","module":"Color","submodule":"Setting"},{"file":"src/color/setting.js","line":180,"description":"<p>colorMode() changes the way p5.js interprets color data. By default, the\nparameters for fill(), stroke(), background(), and color() are defined by\nvalues between 0 and 255 using the RGB color model. This is equivalent to\nsetting colorMode(RGB, 255). Setting colorMode(HSB) lets you use the HSB\nsystem instead. By default, this is colorMode(HSB, 360, 100, 100, 1). You\ncan also use HSL.\n<br><br>\nNote: existing color objects remember the mode that they were created in,\nso you can change modes as you like without affecting their appearance.</p>\n","itemtype":"method","name":"colorMode","params":[{"name":"mode","description":"<p>either RGB or HSB, corresponding to\n Red/Green/Blue and Hue/Saturation/Brightness\n (or Lightness)</p>\n","type":"Constant"},{"name":"max1","description":"<p>range for the red or hue depending on the\n current color mode, or range for all values</p>\n","type":"Number","optional":true},{"name":"max2","description":"<p>range for the green or saturation depending\n on the current color mode</p>\n","type":"Number","optional":true},{"name":"max3","description":"<p>range for the blue or brightness/lighntess\n depending on the current color mode</p>\n","type":"Number","optional":true},{"name":"maxA","description":"<p>range for the alpha</p>\n","type":"Number","optional":true}],"example":["\n<div>\n<code>\nnoStroke();\ncolorMode(RGB, 100);\nfor (i = 0; i < 100; i++) {\n for (j = 0; j < 100; j++) {\n stroke(i, j, 0);\n point(i, j);\n }\n}\n</code>\n</div>\n\n<div>\n<code>\nnoStroke();\ncolorMode(HSB, 100);\nfor (i = 0; i < 100; i++) {\n for (j = 0; j < 100; j++) {\n stroke(i, j, 100);\n point(i, j);\n }\n}\n</code>\n</div>\n\n<div>\n<code>\ncolorMode(RGB, 255);\nvar c = color(127, 255, 0);\n\ncolorMode(RGB, 1);\nvar myColor = c._getRed();\ntext(myColor, 10, 10, 80, 80);\n</code>\n</div>\n\n<div>\n<code>\nnoFill();\ncolorMode(RGB, 255, 255, 255, 1);\nbackground(255);\n\nstrokeWeight(4);\nstroke(255, 0 , 10, 0.3);\nellipse(40, 40, 50, 50);\nellipse(50, 50, 40, 40);\n</code>\n</div>"],"class":"p5","module":"Color","submodule":"Setting"},{"file":"src/color/setting.js","line":283,"description":"<p>Sets the color used to fill shapes. For example, if you run\nfill(204, 102, 0), all subsequent shapes will be filled with orange. This\ncolor is either specified in terms of the RGB or HSB color depending on\nthe current colorMode(). (The default color space is RGB, with each value\nin the range from 0 to 255).\n<br><br>\nIf a single string argument is provided, RGB, RGBA and Hex CSS color strings\nand all named color strings are supported. A p5 Color object can also be\nprovided to set the fill color.</p>\n","itemtype":"method","name":"fill","params":[{"name":"v1","description":"<p>gray value, red or hue value\n (depending on the current color\n mode), or color Array, or CSS\n color string</p>\n","type":"Number|Array|String|p5.Color"},{"name":"v2","description":"<p>green or saturation value\n (depending on the current\n color mode)</p>\n","type":"Number","optional":true},{"name":"v3","description":"<p>blue or brightness value\n (depending on the current\n color mode)</p>\n","type":"Number","optional":true},{"name":"a","description":"<p>opacity of the background</p>\n","type":"Number","optional":true}],"example":["\n<div>\n<code>\n// Grayscale integer value\nfill(51);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// R, G & B integer values\nfill(255, 204, 0);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// H, S & B integer values\ncolorMode(HSB);\nfill(255, 204, 100);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// Named SVG/CSS color string\nfill('red');\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// three-digit hexadecimal RGB notation\nfill('#fae');\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// six-digit hexadecimal RGB notation\nfill('#222222');\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// integer RGB notation\nfill('rgb(0,255,0)');\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// integer RGBA notation\nfill('rgba(0,255,0, 0.25)');\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// percentage RGB notation\nfill('rgb(100%,0%,10%)');\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// percentage RGBA notation\nfill('rgba(100%,0%,100%,0.5)');\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// p5 Color object\nfill(color(0, 0, 255));\nrect(20, 20, 60, 60);\n</code>\n</div>"],"class":"p5","module":"Color","submodule":"Setting"},{"file":"src/color/setting.js","line":404,"description":"<p>Disables filling geometry. If both noStroke() and noFill() are called,\nnothing will be drawn to the screen.</p>\n","itemtype":"method","name":"noFill","example":["\n<div>\n<code>\nrect(15, 10, 55, 55);\nnoFill();\nrect(20, 20, 60, 60);\n</code>\n</div>"],"class":"p5","module":"Color","submodule":"Setting"},{"file":"src/color/setting.js","line":423,"description":"<p>Disables drawing the stroke (outline). If both noStroke() and noFill()\nare called, nothing will be drawn to the screen.</p>\n","itemtype":"method","name":"noStroke","example":["\n<div>\n<code>\nnoStroke();\nrect(20, 20, 60, 60);\n</code>\n</div>"],"class":"p5","module":"Color","submodule":"Setting"},{"file":"src/color/setting.js","line":441,"description":"<p>Sets the color used to draw lines and borders around shapes. This color\nis either specified in terms of the RGB or HSB color depending on the\ncurrent colorMode() (the default color space is RGB, with each value in\nthe range from 0 to 255).\n<br><br>\nIf a single string argument is provided, RGB, RGBA and Hex CSS color\nstrings and all named color strings are supported. A p5 Color object\ncan also be provided to set the stroke color.</p>\n","itemtype":"method","name":"stroke","params":[{"name":"v1","description":"<p>gray value, red or hue value\n (depending on the current color\n mode), or color Array, or CSS\n color string</p>\n","type":"Number|Array|String|p5.Color"},{"name":"v2","description":"<p>green or saturation value\n (depending on the current\n color mode)</p>\n","type":"Number","optional":true},{"name":"v3","description":"<p>blue or brightness value\n (depending on the current\n color mode)</p>\n","type":"Number","optional":true},{"name":"a","description":"<p>opacity of the background</p>\n","type":"Number","optional":true}],"example":["\n<div>\n<code>\n// Grayscale integer value\nstrokeWeight(4);\nstroke(51);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// R, G & B integer values\nstroke(255, 204, 0);\nstrokeWeight(4);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// H, S & B integer values\ncolorMode(HSB);\nstrokeWeight(4);\nstroke(255, 204, 100);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// Named SVG/CSS color string\nstroke('red');\nstrokeWeight(4);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// three-digit hexadecimal RGB notation\nstroke('#fae');\nstrokeWeight(4);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// six-digit hexadecimal RGB notation\nstroke('#222222');\nstrokeWeight(4);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// integer RGB notation\nstroke('rgb(0,255,0)');\nstrokeWeight(4);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// integer RGBA notation\nstroke('rgba(0,255,0,0.25)');\nstrokeWeight(4);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// percentage RGB notation\nstroke('rgb(100%,0%,10%)');\nstrokeWeight(4);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// percentage RGBA notation\nstroke('rgba(100%,0%,100%,0.5)');\nstrokeWeight(4);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// p5 Color object\nstroke(color(0, 0, 255));\nstrokeWeight(4);\nrect(20, 20, 60, 60);\n</code>\n</div>"],"class":"p5","module":"Color","submodule":"Setting"},{"file":"src/core/2d_primitives.js","line":16,"description":"<p>Draw an arc to the screen. If called with only a, b, c, d, start, and\nstop, the arc will be drawn as an open pie. If mode is provided, the arc\nwill be drawn either open, as a chord, or as a pie as specified. The\norigin may be changed with the ellipseMode() function.<br><br>\nNote that drawing a full circle (ex: 0 to TWO_PI) will appear blank\nbecause 0 and TWO_PI are the same position on the unit circle. The\nbest way to handle this is by using the ellipse() function instead\nto create a closed ellipse, and to use the arc() function\nonly to draw parts of an ellipse.</p>\n","itemtype":"method","name":"arc","params":[{"name":"a","description":"<p>x-coordinate of the arc&#39;s ellipse</p>\n","type":"Number"},{"name":"b","description":"<p>y-coordinate of the arc&#39;s ellipse</p>\n","type":"Number"},{"name":"c","description":"<p>width of the arc&#39;s ellipse by default</p>\n","type":"Number"},{"name":"d","description":"<p>height of the arc&#39;s ellipse by default</p>\n","type":"Number"},{"name":"start","description":"<p>angle to start the arc, specified in radians</p>\n","type":"Number"},{"name":"stop","description":"<p>angle to stop the arc, specified in radians</p>\n","type":"Number"},{"name":"mode","description":"<p>optional parameter to determine the way of drawing\n the arc</p>\n","type":"Constant","optional":true}],"return":{"description":"the p5 object","type":"Object"},"example":["\n<div>\n<code>\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);\n</code>\n</div>\n\n<div>\n<code>\narc(50, 50, 80, 80, 0, PI+QUARTER_PI, OPEN);\n</code>\n</div>\n\n<div>\n<code>\narc(50, 50, 80, 80, 0, PI+QUARTER_PI, CHORD);\n</code>\n</div>\n\n<div>\n<code>\narc(50, 50, 80, 80, 0, PI+QUARTER_PI, PIE);\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"2D Primitives"},{"file":"src/core/2d_primitives.js","line":123,"description":"<p>Draws an ellipse (oval) to the screen. An ellipse with equal width and\nheight is a circle. By default, the first two parameters set the location,\nand the third and fourth parameters set the shape&#39;s width and height. If\nno height is specified, the value of width is used for both the width and\nheight. The origin may be changed with the ellipseMode() function.</p>\n","itemtype":"method","name":"ellipse","return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\nellipse(56, 46, 55, 55);\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"2D Primitives","overloads":[{"line":123,"params":[{"name":"x","description":"<p>x-coordinate of the ellipse.</p>\n","type":"Number"},{"name":"y","description":"<p>y-coordinate of the ellipse.</p>\n","type":"Number"},{"name":"w","description":"<p>width of the ellipse.</p>\n","type":"Number"},{"name":"h","description":"<p>height of the ellipse.</p>\n","type":"Number","optional":true}]},{"line":143,"params":[{"name":"x","description":"","type":"Number"},{"name":"y","description":"","type":"Number"},{"name":"w","description":"","type":"Number"},{"name":"h","description":"","type":"Number","optional":true}]}]},{"file":"src/core/2d_primitives.js","line":179,"description":"<p>Draws a line (a direct path between two points) to the screen. The version\nof line() with four parameters draws the line in 2D. To color a line, use\nthe stroke() function. A line cannot be filled, therefore the fill()\nfunction will not affect the color of a line. 2D lines are drawn with a\nwidth of one pixel by default, but this can be changed with the\nstrokeWeight() function.</p>\n","itemtype":"method","name":"line","params":[{"name":"x1","description":"<p>the x-coordinate of the first point</p>\n","type":"Number"},{"name":"y1","description":"<p>the y-coordinate of the first point</p>\n","type":"Number"},{"name":"x2","description":"<p>the x-coordinate of the second point</p>\n","type":"Number"},{"name":"y2","description":"<p>the y-coordinate of the second point</p>\n","type":"Number"}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\nline(30, 20, 85, 75);\n</code>\n</div>\n\n<div>\n<code>\nline(30, 20, 85, 20);\nstroke(126);\nline(85, 20, 85, 75);\nstroke(255);\nline(85, 75, 30, 75);\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"2D Primitives"},{"file":"src/core/2d_primitives.js","line":247,"description":"<p>Draws a point, a coordinate in space at the dimension of one pixel.\nThe first parameter is the horizontal value for the point, the second\nvalue is the vertical value for the point. The color of the point is\ndetermined by the current stroke.</p>\n","itemtype":"method","name":"point","params":[{"name":"x","description":"<p>the x-coordinate</p>\n","type":"Number"},{"name":"y","description":"<p>the y-coordinate</p>\n","type":"Number"}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\npoint(30, 20);\npoint(85, 20);\npoint(85, 75);\npoint(30, 75);\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"2D Primitives"},{"file":"src/core/2d_primitives.js","line":292,"description":"<p>Draw a quad. A quad is a quadrilateral, a four sided polygon. It is\nsimilar to a rectangle, but the angles between its edges are not\nconstrained to ninety degrees. The first pair of parameters (x1,y1)\nsets the first vertex and the subsequent pairs should proceed\nclockwise or counter-clockwise around the defined shape.</p>\n","itemtype":"method","name":"quad","return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\nquad(38, 31, 86, 20, 69, 63, 30, 76);\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"2D Primitives","overloads":[{"line":292,"params":[{"name":"x1","description":"<p>the x-coordinate of the first point</p>\n","type":"Number"},{"name":"y1","description":"<p>the y-coordinate of the first point</p>\n","type":"Number"},{"name":"x2","description":"<p>the x-coordinate of the second point</p>\n","type":"Number"},{"name":"y2","description":"<p>the y-coordinate of the second point</p>\n","type":"Number"},{"name":"x3","description":"<p>the x-coordinate of the third point</p>\n","type":"Number"},{"name":"y3","description":"<p>the y-coordinate of the third point</p>\n","type":"Number"},{"name":"x4","description":"<p>the x-coordinate of the fourth point</p>\n","type":"Number"},{"name":"y4","description":"<p>the y-coordinate of the fourth point</p>\n","type":"Number"}]},{"line":316,"params":[{"name":"x1","description":"","type":"Number"},{"name":"y1","description":"","type":"Number"},{"name":"x2","description":"","type":"Number"},{"name":"y2","description":"","type":"Number"},{"name":"x3","description":"","type":"Number"},{"name":"y3","description":"","type":"Number"},{"name":"x4","description":"","type":"Number"},{"name":"y4","description":"","type":"Number"}]}]},{"file":"src/core/2d_primitives.js","line":366,"description":"<p>Draws a rectangle to the screen. A rectangle is a four-sided shape with\nevery angle at ninety degrees. By default, the first two parameters set\nthe location of the upper-left corner, the third sets the width, and the\nfourth sets the height. The way these parameters are interpreted, however,\nmay be changed with the rectMode() function.\n<br><br>\nThe fifth, sixth, seventh and eighth parameters, if specified,\ndetermine corner radius for the top-right, top-left, lower-right and\nlower-left corners, respectively. An omitted corner radius parameter is set\nto the value of the previously specified radius value in the parameter list.</p>\n","itemtype":"method","name":"rect","return":{"description":"the p5 object.","type":"P5"},"example":["\n<div>\n<code>\n// Draw a rectangle at location (30, 20) with a width and height of 55.\nrect(30, 20, 55, 55);\n</code>\n</div>\n\n<div>\n<code>\n// Draw a rectangle with rounded corners, each having a radius of 20.\nrect(30, 20, 55, 55, 20);\n</code>\n</div>\n\n<div>\n<code>\n// Draw a rectangle with rounded corners having the following radii:\n// top-left = 20, top-right = 15, bottom-right = 10, bottom-left = 5.\nrect(30, 20, 55, 55, 20, 15, 10, 5);\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"2D Primitives","overloads":[{"line":366,"params":[{"name":"x","description":"<p>x-coordinate of the rectangle.</p>\n","type":"Number"},{"name":"y","description":"<p>y-coordinate of the rectangle.</p>\n","type":"Number"},{"name":"w","description":"<p>width of the rectangle.</p>\n","type":"Number"},{"name":"h","description":"<p>height of the rectangle.</p>\n","type":"Number"},{"name":"tl","description":"<p>optional radius of top-left corner.</p>\n","type":"Number","optional":true},{"name":"tr","description":"<p>optional radius of top-right corner.</p>\n","type":"Number","optional":true},{"name":"br","description":"<p>optional radius of bottom-right corner.</p>\n","type":"Number","optional":true},{"name":"bl","description":"<p>optional radius of bottom-left corner.</p>\n","type":"Number","optional":true}]},{"line":411,"params":[{"name":"x","description":"","type":"Number"},{"name":"y","description":"","type":"Number"},{"name":"w","description":"","type":"Number"},{"name":"h","description":"","type":"Number"},{"name":"detailX","description":"","type":"Number","optional":true},{"name":"detailY","description":"","type":"Number","optional":true}]}]},{"file":"src/core/2d_primitives.js","line":448,"description":"<p>A triangle is a plane created by connecting three points. The first two\narguments specify the first point, the middle two arguments specify the\nsecond point, and the last two arguments specify the third point.</p>\n","itemtype":"method","name":"triangle","params":[{"name":"x1","description":"<p>x-coordinate of the first point</p>\n","type":"Number"},{"name":"y1","description":"<p>y-coordinate of the first point</p>\n","type":"Number"},{"name":"x2","description":"<p>x-coordinate of the second point</p>\n","type":"Number"},{"name":"y2","description":"<p>y-coordinate of the second point</p>\n","type":"Number"},{"name":"x3","description":"<p>x-coordinate of the third point</p>\n","type":"Number"},{"name":"y3","description":"<p>y-coordinate of the third point</p>\n","type":"Number"}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\ntriangle(30, 75, 58, 20, 86, 75);\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"2D Primitives"},{"file":"src/core/attributes.js","line":14,"description":"<p>Modifies the location from which ellipses are drawn by changing the way\nin which parameters given to ellipse() are interpreted.\n<br><br>\nThe default mode is ellipseMode(CENTER), which interprets the first two\nparameters of ellipse() as the shape&#39;s center point, while the third and\nfourth parameters are its width and height.\n<br><br>\nellipseMode(RADIUS) also uses the first two parameters of ellipse() as\nthe shape&#39;s center point, but uses the third and fourth parameters to\nspecify half of the shapes&#39;s width and height.\n<br><br>\nellipseMode(CORNER) interprets the first two parameters of ellipse() as\nthe upper-left corner of the shape, while the third and fourth parameters\nare its width and height.\n<br><br>\nellipseMode(CORNERS) interprets the first two parameters of ellipse() as\nthe location of one corner of the ellipse&#39;s bounding box, and the third\nand fourth parameters as the location of the opposite corner.\n<br><br>\nThe parameter must be written in ALL CAPS because Javascript is a\ncase-sensitive language.</p>\n","itemtype":"method","name":"ellipseMode","params":[{"name":"mode","description":"<p>either CENTER, RADIUS, CORNER, or CORNERS</p>\n","type":"Constant"}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\nellipseMode(RADIUS); // Set ellipseMode to RADIUS\nfill(255); // Set fill to white\nellipse(50, 50, 30, 30); // Draw white ellipse using RADIUS mode\n\nellipseMode(CENTER); // Set ellipseMode to CENTER\nfill(100); // Set fill to gray\nellipse(50, 50, 30, 30); // Draw gray ellipse using CENTER mode\n</code>\n</div>\n\n<div>\n<code>\nellipseMode(CORNER); // Set ellipseMode is CORNER\nfill(255); // Set fill to white\nellipse(25, 25, 50, 50); // Draw white ellipse using CORNER mode\n\nellipseMode(CORNERS); // Set ellipseMode to CORNERS\nfill(100); // Set fill to gray\nellipse(25, 25, 50, 50); // Draw gray ellipse using CORNERS mode\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Attributes"},{"file":"src/core/attributes.js","line":75,"description":"<p>Draws all geometry with jagged (aliased) edges. Note that smooth() is\nactive by default, so it is necessary to call noSmooth() to disable\nsmoothing of geometry, images, and fonts.</p>\n","itemtype":"method","name":"noSmooth","return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\nbackground(0);\nnoStroke();\nsmooth();\nellipse(30, 48, 36, 36);\nnoSmooth();\nellipse(70, 48, 36, 36);\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Attributes"},{"file":"src/core/attributes.js","line":99,"description":"<p>Modifies the location from which rectangles are drawn by changing the way\nin which parameters given to rect() are interpreted.\n<br><br>\nThe default mode is rectMode(CORNER), which interprets the first two\nparameters of rect() as the upper-left corner of the shape, while the\nthird and fourth parameters are its width and height.\n<br><br>\nrectMode(CORNERS) interprets the first two parameters of rect() as the\nlocation of one corner, and the third and fourth parameters as the\nlocation of the opposite corner.\n<br><br>\nrectMode(CENTER) interprets the first two parameters of rect() as the\nshape&#39;s center point, while the third and fourth parameters are its\nwidth and height.\n<br><br>\nrectMode(RADIUS) also uses the first two parameters of rect() as the\nshape&#39;s center point, but uses the third and fourth parameters to specify\nhalf of the shapes&#39;s width and height.\n<br><br>\nThe parameter must be written in ALL CAPS because Javascript is a\ncase-sensitive language.</p>\n","itemtype":"method","name":"rectMode","params":[{"name":"mode","description":"<p>either CORNER, CORNERS, CENTER, or RADIUS</p>\n","type":"Constant"}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\nrectMode(CORNER); // Default rectMode is CORNER\nfill(255); // Set fill to white\nrect(25, 25, 50, 50); // Draw white rect using CORNER mode\n\nrectMode(CORNERS); // Set rectMode to CORNERS\nfill(100); // Set fill to gray\nrect(25, 25, 50, 50); // Draw gray rect using CORNERS mode\n</code>\n</div>\n\n<div>\n<code>\nrectMode(RADIUS); // Set rectMode to RADIUS\nfill(255); // Set fill to white\nrect(50, 50, 30, 30); // Draw white rect using RADIUS mode\n\nrectMode(CENTER); // Set rectMode to CENTER\nfill(100); // Set fill to gray\nrect(50, 50, 30, 30); // Draw gray rect using CENTER mode\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Attributes"},{"file":"src/core/attributes.js","line":160,"description":"<p>Draws all geometry with smooth (anti-aliased) edges. smooth() will also\nimprove image quality of resized images. Note that smooth() is active by\ndefault; noSmooth() can be used to disable smoothing of geometry,\nimages, and fonts.</p>\n","itemtype":"method","name":"smooth","return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\nbackground(0);\nnoStroke();\nsmooth();\nellipse(30, 48, 36, 36);\nnoSmooth();\nellipse(70, 48, 36, 36);\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Attributes"},{"file":"src/core/attributes.js","line":185,"description":"<p>Sets the style for rendering line endings. These ends are either squared,\nextended, or rounded, each of which specified with the corresponding\nparameters: SQUARE, PROJECT, and ROUND. The default cap is ROUND.</p>\n","itemtype":"method","name":"strokeCap","params":[{"name":"cap","description":"<p>either SQUARE, PROJECT, or ROUND</p>\n","type":"Number/Constant"}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\nstrokeWeight(12.0);\nstrokeCap(ROUND);\nline(20, 30, 80, 30);\nstrokeCap(SQUARE);\nline(20, 50, 80, 50);\nstrokeCap(PROJECT);\nline(20, 70, 80, 70);\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Attributes"},{"file":"src/core/attributes.js","line":215,"description":"<p>Sets the style of the joints which connect line segments. These joints\nare either mitered, beveled, or rounded and specified with the\ncorresponding parameters MITER, BEVEL, and ROUND. The default joint is\nMITER.</p>\n","itemtype":"method","name":"strokeJoin","params":[{"name":"join","description":"<p>either MITER, BEVEL, ROUND</p>\n","type":"Number/Constant"}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\nnoFill();\nstrokeWeight(10.0);\nstrokeJoin(MITER);\nbeginShape();\nvertex(35, 20);\nvertex(65, 50);\nvertex(35, 80);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\nnoFill();\nstrokeWeight(10.0);\nstrokeJoin(BEVEL);\nbeginShape();\nvertex(35, 20);\nvertex(65, 50);\nvertex(35, 80);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\nnoFill();\nstrokeWeight(10.0);\nstrokeJoin(ROUND);\nbeginShape();\nvertex(35, 20);\nvertex(65, 50);\nvertex(35, 80);\nendShape();\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Attributes"},{"file":"src/core/attributes.js","line":273,"description":"<p>Sets the width of the stroke used for lines, points, and the border\naround shapes. All widths are set in units of pixels.</p>\n","itemtype":"method","name":"strokeWeight","params":[{"name":"weight","description":"<p>the weight (in pixels) of the stroke</p>\n","type":"Number"}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\nstrokeWeight(1); // Default\nline(20, 20, 80, 20);\nstrokeWeight(4); // Thicker\nline(20, 40, 80, 40);\nstrokeWeight(10); // Beastly\nline(20, 70, 80, 70);\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Attributes"},{"file":"src/core/canvas.js","line":1,"requires":["constants"],"class":"p5","module":"Shape"},{"file":"src/core/constants.js","line":25,"description":"<p>HALF_PI is a mathematical constant with the value\n1.57079632679489661923. It is half the ratio of the\ncircumference of a circle to its diameter. It is useful in\ncombination with the trigonometric functions sin() and cos().</p>\n","itemtype":"property","name":"HALF_PI","example":["\n<div><code>\narc(50, 50, 80, 80, 0, HALF_PI);\n</code></div>\n"],"class":"p5","module":"Constants","submodule":"Constants"},{"file":"src/core/constants.js","line":40,"description":"<p>PI is a mathematical constant with the value\n3.14159265358979323846. It is the ratio of the circumference\nof a circle to its diameter. It is useful in combination with\nthe trigonometric functions sin() and cos().</p>\n","itemtype":"property","name":"PI","example":["\n<div><code>\narc(50, 50, 80, 80, 0, PI);\n</code></div>"],"class":"p5","module":"Constants","submodule":"Constants"},{"file":"src/core/constants.js","line":54,"description":"<p>QUARTER_PI is a mathematical constant with the value 0.7853982.\nIt is one quarter the ratio of the circumference of a circle to\nits diameter. It is useful in combination with the trigonometric\nfunctions sin() and cos().</p>\n","itemtype":"property","name":"QUARTER_PI","example":["\n<div><code>\narc(50, 50, 80, 80, 0, QUARTER_PI);\n</code></div>\n"],"class":"p5","module":"Constants","submodule":"Constants"},{"file":"src/core/constants.js","line":69,"description":"<p>TAU is an alias for TWO_PI, a mathematical constant with the\nvalue 6.28318530717958647693. It is twice the ratio of the\ncircumference of a circle to its diameter. It is useful in\ncombination with the trigonometric functions sin() and cos().</p>\n","itemtype":"property","name":"TAU","example":["\n<div><code>\narc(50, 50, 80, 80, 0, TAU);\n</code></div>\n"],"class":"p5","module":"Constants","submodule":"Constants"},{"file":"src/core/constants.js","line":84,"description":"<p>TWO_PI is a mathematical constant with the value\n6.28318530717958647693. It is twice the ratio of the\ncircumference of a circle to its diameter. It is useful in\ncombination with the trigonometric functions sin() and cos().</p>\n","itemtype":"property","name":"TWO_PI","example":["\n<div><code>\narc(50, 50, 80, 80, 0, TWO_PI);\n</code></div>\n"],"class":"p5","module":"Constants","submodule":"Constants"},{"file":"src/core/core.js","line":15,"description":"<p>This is the p5 instance constructor.</p>\n<p>A p5 instance holds all the properties and methods related to\na p5 sketch. It expects an incoming sketch closure and it can also\ntake an optional node parameter for attaching the generated p5 canvas\nto a node. The sketch closure takes the newly created p5 instance as\nits sole argument and may optionally set preload(), setup(), and/or\ndraw() properties on it for running a sketch.</p>\n<p>A p5 sketch can run in &quot;global&quot; or &quot;instance&quot; mode:\n&quot;global&quot; - all properties and methods are attached to the window\n&quot;instance&quot; - all properties and methods are bound to this p5 object</p>\n","params":[{"name":"sketch","description":"<p>a closure that can set optional preload(),\n setup(), and/or draw() properties on the\n given p5 instance</p>\n","type":"Function"},{"name":"node","description":"<p>element to attach canvas to, if a\n boolean is passed in use it as sync</p>\n","type":"HTMLElement|boolean","optional":true},{"name":"sync","description":"<p>start synchronously (optional)</p>\n","type":"Boolean","optional":true}],"return":{"description":"a p5 instance","type":"P5"},"class":"p5","module":"Structure","submodule":"Structure"},{"file":"src/core/core.js","line":49,"description":"<p>Called directly before setup(), the preload() function is used to handle\nasynchronous loading of external files. If a preload function is\ndefined, setup() will wait until any load calls within have finished.\nNothing besides load calls should be inside preload (loadImage,\nloadJSON, loadFont, loadStrings, etc).</p>\n","itemtype":"method","name":"preload","example":["\n<div><code>\nvar img;\nvar c;\nfunction preload() { // preload() runs once\n img = loadImage('assets/laDefense.jpg');\n}\n\nfunction setup() { // 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</code></div>"],"class":"p5","module":"Structure","submodule":"Structure"},{"file":"src/core/core.js","line":78,"description":"<p>The setup() function is called once when the program starts. It&#39;s used to\ndefine initial environment properties such as screen size and background\ncolor and to load media such as images and fonts as the program starts.\nThere can only be one setup() function for each program and it shouldn&#39;t\nbe called again after its initial execution.\n<br><br>\nNote: Variables declared within setup() are not accessible within other\nfunctions, including draw().</p>\n","itemtype":"method","name":"setup","example":["\n<div><code>\nvar 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</code></div>"],"class":"p5","module":"Structure","submodule":"Structure"},{"file":"src/core/core.js","line":105,"description":"<p>Called directly after setup(), the draw() function continuously executes\nthe lines of code contained inside its block until the program is stopped\nor noLoop() is called. Note if noLoop() is called in setup(), draw() will\nstill be executed once before stopping. draw() is called automatically and\nshould never be called explicitly.\n<br><br>\nIt should always be controlled with noLoop(), redraw() and loop(). After\nnoLoop() stops the code in draw() from executing, redraw() causes the\ncode inside draw() to execute once, and loop() will cause the code\ninside draw() to resume executing continuously.\n<br><br>\nThe number of times draw() executes in each second may be controlled with\nthe frameRate() function.\n<br><br>\nThere can only be one draw() function for each sketch, and draw() must\nexist if you want the code to run continuously, or to process events such\nas mousePressed(). Sometimes, you might have an empty call to draw() in\nyour program, as shown in the above example.\n<br><br>\nIt is important to note that the drawing coordinate system will be reset\nat the beginning of each draw() call. If any transformations are performed\nwithin draw() (ex: scale, rotate, translate, their effects will be\nundone at the beginning of draw(), so transformations will not accumulate\nover time. On the other hand, styling applied (ex: fill, stroke, etc) will\nremain in effect.</p>\n","itemtype":"method","name":"draw","example":["\n<div><code>\nvar yPos = 0;\nfunction setup() { // setup() runs once\n frameRate(30);\n}\nfunction draw() { // 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</code></div>"],"class":"p5","module":"Structure","submodule":"Structure"},{"file":"src/core/core.js","line":375,"description":"<p>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.</p>\n","itemtype":"method","name":"remove","example":["\n<div class='norender'><code>\nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n</code></div>"],"class":"p5","module":"Structure","submodule":"Structure"},{"file":"src/core/curves.js","line":17,"description":"<p>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 &quot;pull&quot; the curve\ntowards them.<br /><br />Bezier curves were developed by French\nautomotive engineer Pierre Bezier, and are commonly used in computer\ngraphics to define gently sloping curves. See also curve().</p>\n","itemtype":"method","name":"bezier","return":{"description":"the p5 object","type":"Object"},"example":["\n<div>\n<code>\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</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Curves","overloads":[{"line":17,"params":[{"name":"x1","description":"<p>x-coordinate for the first anchor point</p>\n","type":"Number"},{"name":"y1","description":"<p>y-coordinate for the first anchor point</p>\n","type":"Number"},{"name":"x2","description":"<p>x-coordinate for the first control point</p>\n","type":"Number"},{"name":"y2","description":"<p>y-coordinate for the first control point</p>\n","type":"Number"},{"name":"x3","description":"<p>x-coordinate for the second control point</p>\n","type":"Number"},{"name":"y3","description":"<p>y-coordinate for the second control point</p>\n","type":"Number"},{"name":"x4","description":"<p>x-coordinate for the second anchor point</p>\n","type":"Number"},{"name":"y4","description":"<p>y-coordinate for the second anchor point</p>\n","type":"Number"}]},{"line":50,"params":[{"name":"z1","description":"<p>z-coordinate for the first anchor point</p>\n","type":"Number"},{"name":"z2","description":"<p>z-coordinate for the first control point</p>\n","type":"Number"},{"name":"z3","description":"<p>z-coordinate for the first anchor point</p>\n","type":"Number"},{"name":"z4","description":"<p>z-coordinate for the first control point</p>\n","type":"Number"}]}]},{"file":"src/core/curves.js","line":106,"description":"<p>Sets the resolution at which Beziers display.</p>\n<p>The default value is 20.</p>\n","params":[{"name":"detail","description":"<p>resolution of the curves</p>\n","type":"Number"}],"return":{"description":"the p5 object","type":"Object"},"example":["\n<div>\n<code>\nbackground(204);\nbezierDetail(50);\nbezier(85, 20, 10, 10, 90, 90, 15, 80);\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Curves"},{"file":"src/core/curves.js","line":127,"description":"<p>Evaluates 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.\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.</p>\n","itemtype":"method","name":"bezierPoint","params":[{"name":"a","description":"<p>coordinate of first point on the curve</p>\n","type":"Number"},{"name":"b","description":"<p>coordinate of first control point</p>\n","type":"Number"},{"name":"c","description":"<p>coordinate of second control point</p>\n","type":"Number"},{"name":"d","description":"<p>coordinate of second point on the curve</p>\n","type":"Number"},{"name":"t","description":"<p>value between 0 and 1</p>\n","type":"Number"}],"return":{"description":"the value of the Bezier at position t","type":"Number"},"example":["\n<div>\n<code>\nnoFill();\nx1 = 85, x2 = 10, x3 = 90, x4 = 15;\ny1 = 20, y2 = 10, y3 = 90, y4 = 80;\nbezier(x1, y1, x2, y2, x3, y3, x4, y4);\nfill(255);\nsteps = 10;\nfor (i = 0; i <= steps; i++) {\n t = i / steps;\n x = bezierPoint(x1, x2, x3, x4, t);\n y = bezierPoint(y1, y2, y3, y4, t);\n ellipse(x, y, 5, 5);\n}\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Curves"},{"file":"src/core/curves.js","line":168,"description":"<p>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.</p>\n","itemtype":"method","name":"bezierTangent","params":[{"name":"a","description":"<p>coordinate of first point on the curve</p>\n","type":"Number"},{"name":"b","description":"<p>coordinate of first control point</p>\n","type":"Number"},{"name":"c","description":"<p>coordinate of second control point</p>\n","type":"Number"},{"name":"d","description":"<p>coordinate of second point on the curve</p>\n","type":"Number"},{"name":"t","description":"<p>value between 0 and 1</p>\n","type":"Number"}],"return":{"description":"the tangent at position t","type":"Number"},"example":["\n<div>\n<code>\nnoFill();\nbezier(85, 20, 10, 10, 90, 90, 15, 80);\nsteps = 6;\nfill(255);\nfor (i = 0; i <= steps; i++) {\n t = i / steps;\n // Get the location of the point\n x = bezierPoint(85, 10, 90, 15, t);\n y = bezierPoint(20, 10, 90, 80, t);\n // Get the tangent points\n tx = bezierTangent(85, 10, 90, 15, t);\n ty = bezierTangent(20, 10, 90, 80, t);\n // Calculate an angle from the tangent points\n 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</code>\n</div>\n\n<div>\n<code>\nnoFill();\nbezier(85, 20, 10, 10, 90, 90, 15, 80);\nstroke(255, 102, 0);\nsteps = 16;\nfor (i = 0; i <= steps; i++) {\n t = i / steps;\n x = bezierPoint(85, 10, 90, 15, t);\n y = bezierPoint(20, 10, 90, 80, t);\n tx = bezierTangent(85, 10, 90, 15, t);\n ty = bezierTangent(20, 10, 90, 80, t);\n a = atan2(ty, tx);\n a -= HALF_PI;\n line(x, y, cos(a)*8 + x, sin(a)*8 + y);\n}\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Curves"},{"file":"src/core/curves.js","line":239,"description":"<p>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&#39;s not drawn. The last\ntwo parameters similarly describe the other control point. <br /><br />\nLonger curves can be created by putting a series of curve() functions\ntogether or using curveVertex(). An additional function called\ncurveTightness() provides control for the visual quality of the curve.\nThe curve() function is an implementation of Catmull-Rom splines.</p>\n","itemtype":"method","name":"curve","return":{"description":"the p5 object","type":"Object"},"example":["\n<div>\n<code>\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</code>\n</div>\n<div>\n<code>\n// Define the curve points as JavaScript objects\np1 = {x: 5, y: 26}, p2 = {x: 73, y: 24}\np3 = {x: 73, y: 61}, 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</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Curves","overloads":[{"line":239,"params":[{"name":"x1","description":"<p>x-coordinate for the beginning control point</p>\n","type":"Number"},{"name":"y1","description":"<p>y-coordinate for the beginning control point</p>\n","type":"Number"},{"name":"x2","description":"<p>x-coordinate for the first point</p>\n","type":"Number"},{"name":"y2","description":"<p>y-coordinate for the first point</p>\n","type":"Number"},{"name":"x3","description":"<p>x-coordinate for the second point</p>\n","type":"Number"},{"name":"y3","description":"<p>y-coordinate for the second point</p>\n","type":"Number"},{"name":"x4","description":"<p>x-coordinate for the ending control point</p>\n","type":"Number"},{"name":"y4","description":"<p>y-coordinate for the ending control point</p>\n","type":"Number"}]},{"line":286,"params":[{"name":"z1","description":"<p>z-coordinate for the beginning control point</p>\n","type":"Number"},{"name":"z2","description":"<p>z-coordinate for the first point</p>\n","type":"Number"},{"name":"z3","description":"<p>z-coordinate for the second point</p>\n","type":"Number"},{"name":"z4","description":"<p>z-coordinate for the ending control point</p>\n","type":"Number"}]}]},{"file":"src/core/curves.js","line":344,"description":"<p>Sets the resolution at which curves display.</p>\n<p>The default value is 20.</p>\n","params":[{"name":"resolution","description":"<p>of the curves</p>\n","type":"Number"}],"return":{"description":"the p5 object","type":"Object"},"example":["\n<div>\n<code>\nbackground(204);\ncurveDetail(20);\ncurve(5, 26, 5, 26, 73, 24, 73, 61);\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Curves"},{"file":"src/core/curves.js","line":365,"description":"<p>Modifies the quality of forms created with curve() and curveVertex().\nThe parameter tightness determines how the curve fits to the vertex\npoints. The value 0.0 is the default value for tightness (this value\ndefines the curves to be Catmull-Rom splines) and the value 1.0 connects\nall the points with straight lines. Values within the range -5.0 and 5.0\nwill deform the curves but will leave them recognizable and as values\nincrease in magnitude, they will continue to deform.</p>\n","itemtype":"method","name":"curveTightness","params":[{"name":"amount","description":"<p>of deformation from the original vertices</p>\n","type":"Number"}],"return":{"description":"the p5 object","type":"Object"},"example":["\n<div>\n<code>\n// Move the mouse left and right to see the curve change\n\nfunction setup() {\n createCanvas(100, 100);\n noFill();\n}\n\nfunction draw() {\n background(204);\n var 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</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Curves"},{"file":"src/core/curves.js","line":407,"description":"<p>Evaluates the curve at position t for points a, b, c, d.\nThe parameter t varies between 0 and 1, a and d are points\non the curve, and b and c are the control points.\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.</p>\n","itemtype":"method","name":"curvePoint","params":[{"name":"a","description":"<p>coordinate of first point on the curve</p>\n","type":"Number"},{"name":"b","description":"<p>coordinate of first control point</p>\n","type":"Number"},{"name":"c","description":"<p>coordinate of second control point</p>\n","type":"Number"},{"name":"d","description":"<p>coordinate of second point on the curve</p>\n","type":"Number"},{"name":"t","description":"<p>value between 0 and 1</p>\n","type":"Number"}],"return":{"description":"bezier value at position t","type":"Number"},"example":["\n<div>\n<code>\nnoFill();\ncurve(5, 26, 5, 26, 73, 24, 73, 61);\ncurve(5, 26, 73, 24, 73, 61, 15, 65);\nfill(255);\nellipseMode(CENTER);\nsteps = 6;\nfor (i = 0; i <= steps; i++) {\n t = i / steps;\n x = curvePoint(5, 5, 73, 73, t);\n 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</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Curves"},{"file":"src/core/curves.js","line":452,"description":"<p>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.</p>\n","itemtype":"method","name":"curveTangent","params":[{"name":"a","description":"<p>coordinate of first point on the curve</p>\n","type":"Number"},{"name":"b","description":"<p>coordinate of first control point</p>\n","type":"Number"},{"name":"c","description":"<p>coordinate of second control point</p>\n","type":"Number"},{"name":"d","description":"<p>coordinate of second point on the curve</p>\n","type":"Number"},{"name":"t","description":"<p>value between 0 and 1</p>\n","type":"Number"}],"return":{"description":"the tangent at position t","type":"Number"},"example":["\n<div>\n<code>\nnoFill();\ncurve(5, 26, 73, 24, 73, 61, 15, 65);\nsteps = 6;\nfor (i = 0; i <= steps; i++) {\n t = i / steps;\n x = curvePoint(5, 73, 73, 15, t);\n y = curvePoint(26, 24, 61, 65, t);\n //ellipse(x, y, 5, 5);\n tx = curveTangent(5, 73, 73, 15, t);\n ty = curveTangent(26, 24, 61, 65, t);\n a = atan2(ty, tx);\n a -= PI/2.0;\n line(x, y, cos(a)*8 + x, sin(a)*8 + y);\n}\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Curves"},{"file":"src/core/environment.js","line":22,"description":"<p>The println() function writes to the console area of your browser.\nThis function is often helpful for looking at the data a program is\nproducing. This function creates a new line of text for each call to\nthe function. Individual elements can be\nseparated with quotes (&quot;&quot;) and joined with the addition operator (+).\n<br><br>\nWhile println() is similar to console.log(), it does not directly map to\nit in order to simulate easier to understand behavior than\nconsole.log(). Due to this, it is slower. For fastest results, use\nconsole.log().</p>\n","itemtype":"method","name":"println","params":[{"name":"contents","description":"<p>any combination of Number, String, Object, Boolean,\n Array to print</p>\n","type":"Any"}],"example":["\n<div><code class='norender'>\nvar x = 10;\nprintln(\"The value of x is \" + x);\n// prints \"The value of x is 10\"\n</code></div>"],"class":"p5","module":"Environment","submodule":"Environment"},{"file":"src/core/environment.js","line":65,"description":"<p>The system variable frameCount contains the number of frames that have\nbeen displayed since the program started. Inside setup() the value is 0,\nafter the first iteration of draw it is 1, etc.</p>\n","itemtype":"property","name":"frameCount","example":["\n <div><code>\n function setup() {\n frameRate(30);\n textSize(20);\n textSize(30);\n textAlign(CENTER);\n }\n\n function draw() {\n background(200);\n text(frameCount, width/2, height/2);\n }\n </code></div>"],"class":"p5","module":"Environment","submodule":"Environment"},{"file":"src/core/environment.js","line":88,"description":"<p>Confirms if the window a p5.js program is in is &quot;focused,&quot; meaning that\nthe sketch will accept mouse or keyboard input. This variable is\n&quot;true&quot; if the window is focused and &quot;false&quot; if not.</p>\n","itemtype":"property","name":"focused","example":["\n<div><code>\n// To demonstrate, put two windows side by side.\n// Click on the window that the p5 sketch isn't in!\nfunction draw() {\n background(200);\n noStroke();\n fill(0, 200, 0);\n ellipse(25, 25, 50, 50);\n\n if (!focused) { // or \"if (focused === false)\"\n stroke(200,0,0);\n line(0, 0, 100, 100);\n line(100, 0, 0, 100);\n }\n}\n</code></div>"],"class":"p5","module":"Environment","submodule":"Environment"},{"file":"src/core/environment.js","line":114,"description":"<p>Sets the cursor to a predefined symbol or an image, or makes it visible\nif already hidden. If you are trying to set an image as the cursor, the\nrecommended size is 16x16 or 32x32 pixels. It is not possible to load an\nimage as the cursor if you are exporting your program for the Web, and not\nall MODES work with all browsers. The values for parameters x and y must\nbe less than the dimensions of the image.</p>\n","itemtype":"method","name":"cursor","params":[{"name":"type","description":"<p>either ARROW, CROSS, HAND, MOVE, TEXT, or\n WAIT, or path for image</p>\n","type":"Number/Constant"},{"name":"x","description":"<p>the horizontal active spot of the cursor</p>\n","type":"Number","optional":true},{"name":"y","description":"<p>the vertical active spot of the cursor</p>\n","type":"Number","optional":true}],"example":["\n<div><code>\n// Move the mouse left and right across the image\n// to see the cursor change from a cross to a hand\nfunction draw() {\n line(width/2, 0, width/2, height);\n if (mouseX < 50) {\n cursor(CROSS);\n } else {\n cursor(HAND);\n }\n}\n</code></div>"],"class":"p5","module":"Environment","submodule":"Environment"},{"file":"src/core/environment.js","line":168,"description":"<p>Specifies the number of frames to be displayed every second. For example,\nthe function call frameRate(30) will attempt to refresh 30 times a second.\nIf the processor is not fast enough to maintain the specified rate, the\nframe rate will not be achieved. Setting the frame rate within setup() is\nrecommended. The default rate is 60 frames per second. This is the same as\nsetFrameRate(val).\n<br><br>\nCalling frameRate() with no arguments returns the current framerate. This\nis the same as getFrameRate().\n<br><br>\nCalling frameRate() with arguments that are not of the type numbers\nor are non positive also returns current framerate.</p>\n","itemtype":"method","name":"frameRate","params":[{"name":"fps","description":"<p>number of frames to be displayed every second</p>\n","type":"Number","optional":true}],"return":{"description":"current frameRate","type":"Number"},"example":["\n\n<div><code>\nvar rectX = 0;\nvar fr = 30; //starting FPS\nvar clr;\n\nfunction setup() {\n background(200);\n frameRate(fr); // Attempt to refresh at starting FPS\n clr = color(255,0,0);\n}\n\nfunction draw() {\n background(200);\n rectX = rectX += 1; // Move Rectangle\n\n if (rectX >= width) { // If you go off screen.\n if (fr == 30) {\n clr = color(0,0,255);\n fr = 10;\n frameRate(fr); // make frameRate 10 FPS\n } else {\n clr = color(255,0,0);\n fr = 30;\n frameRate(fr); // make frameRate 30 FPS\n }\n rectX = 0;\n }\n fill(clr);\n rect(rectX, 40, 20,20);\n}\n</div></code>\n"],"class":"p5","module":"Environment","submodule":"Environment"},{"file":"src/core/environment.js","line":229,"description":"<p>Returns the current framerate.</p>\n","return":{"description":"current frameRate","type":"Number"},"class":"p5","module":"Environment","submodule":"Environment"},{"file":"src/core/environment.js","line":238,"description":"<p>Specifies the number of frames to be displayed every second. For example,\nthe function call frameRate(30) will attempt to refresh 30 times a second.\nIf the processor is not fast enough to maintain the specified rate, the\nframe rate will not be achieved. Setting the frame rate within setup() is\nrecommended. The default rate is 60 frames per second.</p>\n<p>Calling frameRate() with no arguments returns the current framerate.</p>\n","params":[{"name":"fps","description":"<p>number of frames to be displayed every second</p>\n","type":"Number","optional":true}],"class":"p5","module":"Environment","submodule":"Environment"},{"file":"src/core/environment.js","line":253,"description":"<p>Hides the cursor from view.</p>\n","itemtype":"method","name":"noCursor","example":["\n<div><code>\nfunction setup() {\n noCursor();\n}\n\nfunction draw() {\n background(200);\n ellipse(mouseX, mouseY, 10, 10);\n}\n</code></div>"],"class":"p5","module":"Environment","submodule":"Environment"},{"file":"src/core/environment.js","line":274,"description":"<p>System variable that stores the width of the entire screen display. This\nis used to run a full-screen program on any display size.</p>\n","itemtype":"property","name":"displayWidth","example":["\n<div class=\"norender\"><code>\ncreateCanvas(displayWidth, displayHeight);\n</code></div>"],"class":"p5","module":"Environment","submodule":"Environment"},{"file":"src/core/environment.js","line":286,"description":"<p>System variable that stores the height of the entire screen display. This\nis used to run a full-screen program on any display size.</p>\n","itemtype":"property","name":"displayHeight","example":["\n<div class=\"norender\"><code>\ncreateCanvas(displayWidth, displayHeight);\n</code></div>"],"class":"p5","module":"Environment","submodule":"Environment"},{"file":"src/core/environment.js","line":298,"description":"<p>System variable that stores the width of the inner window, it maps to\nwindow.innerWidth.</p>\n","itemtype":"property","name":"windowWidth","example":["\n<div class=\"norender\"><code>\ncreateCanvas(windowWidth, windowHeight);\n</code></div>"],"class":"p5","module":"Environment","submodule":"Environment"},{"file":"src/core/environment.js","line":309,"description":"<p>System variable that stores the height of the inner window, it maps to\nwindow.innerHeight.</p>\n","itemtype":"property","name":"windowHeight","example":["\n<div class=\"norender\"><code>\ncreateCanvas(windowWidth, windowHeight);\n</code></div>"],"class":"p5","module":"Environment","submodule":"Environment"},{"file":"src/core/environment.js","line":321,"description":"<p>The windowResized() function is called once every time the browser window\nis resized. This is a good place to resize the canvas or do any other\nadjustements to accomodate the new window size.</p>\n","itemtype":"method","name":"windowResized","example":["\n<div class=\"norender\"><code>\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</code></div>"],"class":"p5","module":"Environment","submodule":"Environment"},{"file":"src/core/environment.js","line":366,"description":"<p>System variable that stores the width of the drawing canvas. This value\nis set by the first parameter of the createCanvas() function.\nFor example, the function call createCanvas(320, 240) sets the width\nvariable to the value 320. The value of width defaults to 100 if\ncreateCanvas() is not used in a program.</p>\n","itemtype":"property","name":"width","class":"p5","module":"Environment","submodule":"Environment"},{"file":"src/core/environment.js","line":377,"description":"<p>System variable that stores the height of the drawing canvas. This value\nis set by the second parameter of the createCanvas() function. For\nexample, the function call createCanvas(320, 240) sets the height\nvariable to the value 240. The value of height defaults to 100 if\ncreateCanvas() is not used in a program.</p>\n","itemtype":"property","name":"height","class":"p5","module":"Environment","submodule":"Environment"},{"file":"src/core/environment.js","line":388,"description":"<p>If argument is given, sets the sketch to fullscreen or not based on the\nvalue of the argument. If no argument is given, returns the current\nfullscreen state. Note that due to browser restrictions this can only\nbe called on user input, for example, on mouse press like the example\nbelow.</p>\n","itemtype":"method","name":"fullscreen","params":[{"name":"val","description":"<p>whether the sketch should be in fullscreen mode\nor not</p>\n","type":"Boolean","optional":true}],"return":{"description":"current fullscreen state","type":"Boolean"},"example":["\n<div>\n<code>\n// Clicking in the box toggles fullscreen on and off.\nfunction setup() {\n background(200);\n}\nfunction mousePressed() {\n if (mouseX > 0 && mouseX < 100 && mouseY > 0 && mouseY < 100) {\n var fs = fullscreen();\n fullscreen(!fs);\n }\n}\n</code>\n</div>"],"class":"p5","module":"Environment","submodule":"Environment"},{"file":"src/core/environment.js","line":431,"description":"<p>Sets the pixel scaling for high pixel density displays. By default\npixel density is set to match display density, call pixelDensity(1)\nto turn this off. Calling pixelDensity() with no arguments returns\nthe current pixel density of the sketch.</p>\n","itemtype":"method","name":"pixelDensity","params":[{"name":"val","description":"<p>whether or how much the sketch should scale</p>\n","type":"Number","optional":true}],"return":{"description":"current pixel density of the sketch","type":"Number"},"example":["\n<div>\n<code>\nfunction setup() {\n pixelDensity(1);\n createCanvas(100, 100);\n background(200);\n ellipse(width/2, height/2, 50, 50);\n}\n</code>\n</div>\n<div>\n<code>\nfunction setup() {\n pixelDensity(3.0);\n createCanvas(100, 100);\n background(200);\n ellipse(width/2, height/2, 50, 50);\n}\n</code>\n</div>"],"class":"p5","module":"Environment","submodule":"Environment"},{"file":"src/core/environment.js","line":472,"description":"<p>Returns the pixel density of the current display the sketch is running on.</p>\n","itemtype":"method","name":"displayDensity","return":{"description":"current pixel density of the display","type":"Number"},"example":["\n<div>\n<code>\nfunction setup() {\n var density = displayDensity();\n pixelDensity(density);\n createCanvas(100, 100);\n background(200);\n ellipse(width/2, height/2, 50, 50);\n}\n</code>\n</div>"],"class":"p5","module":"Environment","submodule":"Environment"},{"file":"src/core/environment.js","line":526,"description":"<p>Gets the current URL.</p>\n","itemtype":"method","name":"getURL","return":{"description":"url","type":"String"},"example":["\n<div>\n<code>\nvar url;\nvar x = 100;\n\nfunction setup() {\n fill(0);\n noStroke();\n url = getURL();\n}\n\nfunction draw() {\n background(200);\n text(url, x, height/2);\n x--;\n}\n</code>\n</div>"],"class":"p5","module":"Environment","submodule":"Environment"},{"file":"src/core/environment.js","line":553,"description":"<p>Gets the current URL path as an array.</p>\n","itemtype":"method","name":"getURLPath","return":{"description":"path components","type":"Array"},"example":["\n<div class='norender'><code>\nfunction setup() {\n var urlPath = getURLPath();\n for (var i=0; i&lt;urlPath.length; i++) {\n text(urlPath[i], 10, i*20+20);\n }\n}\n</code></div>"],"class":"p5","module":"Environment","submodule":"Environment"},{"file":"src/core/environment.js","line":570,"description":"<p>Gets the current URL params as an Object.</p>\n","itemtype":"method","name":"getURLParams","return":{"description":"URL params","type":"Object"},"example":["\n<div class='norender'>\n<code>\n// Example: http://p5js.org?year=2014&month=May&day=15\n\nfunction setup() {\n var params = getURLParams();\n text(params.day, 10, 20);\n text(params.month, 10, 40);\n text(params.year, 10, 60);\n}\n</code>\n</div>"],"class":"p5","module":"Environment","submodule":"Environment"},{"file":"src/core/error_helpers.js","line":1,"requires":["core"],"class":"p5","module":"Environment"},{"file":"src/core/error_helpers.js","line":39,"description":"<p>Checks the definition type against the argument type\nIf any of these passes (in order), it matches:</p>\n<ul>\n<li>p5.* definitions are checked with instanceof</li>\n<li>Booleans are let through (everything is truthy or falsey)</li>\n<li>Lowercase of the definition is checked against the js type</li>\n<li>Number types are checked to see if they are numerically castable</li>\n</ul>\n","class":"p5","module":"Environment"},{"file":"src/core/error_helpers.js","line":59,"description":"<p>Prints out a fancy, colorful message to the console log</p>\n","params":[{"name":"message","description":"<p>the words to be said</p>\n","type":"String"},{"name":"func","description":"<p>the name of the function to link</p>\n","type":"String"},{"name":"color","description":"<p>CSS color string or error type</p>\n","type":"Integer/Color String"}],"return":{"description":"console logs"},"class":"p5","module":"Environment"},{"file":"src/core/error_helpers.js","line":106,"description":"<p>Validate all the parameters of a function for number and type\nNOTE THIS FUNCTION IS TEMPORARILY DISABLED UNTIL FURTHER WORK\nAND UPDATES ARE IMPLEMENTED. -LMCCART</p>\n","params":[{"name":"func","description":"<p>name of function we&#39;re checking</p>\n","type":"String"},{"name":"args","description":"<p>pass of the JS default arguments array</p>\n","type":"Array"},{"name":"types","description":"<p>List of types accepted [&#39;Number&#39;, &#39;String, ...] OR\n a list of lists for each format: [\n [&#39;String&#39;, &#39;Number&#39;, &#39;Number&#39;],\n [&#39;String&#39;, &#39;Number&#39;, &#39;Number&#39;, &#39;Number&#39;, &#39;Number&#39;\n ]</p>\n","type":"Array"}],"return":{"description":"console logs"},"class":"p5","module":"Environment"},{"file":"src/core/error_helpers.js","line":244,"description":"<p>Prints out all the colors in the color pallete with white text.\nFor color blindness testing.</p>\n","class":"p5","module":"Environment"},{"file":"src/core/p5.Element.js","line":25,"description":"<p>Underlying HTML element. All normal HTML methods can be called on this.</p>\n","itemtype":"property","name":"elt","class":"p5.Element","module":"DOM","submodule":"DOM"},{"file":"src/core/p5.Element.js","line":37,"description":"<p>Attaches the element to the parent specified. A way of setting\n the container for the element. Accepts either a string ID, DOM\n node, or p5.Element. If no arguments given, parent node is returned.\n For more ways to position the canvas, see the\n <a href='https://github.com/processing/p5.js/wiki/Positioning-your-canvas'>\n positioning the canvas</a> wiki page.</p>\n","itemtype":"method","name":"parent","params":[{"name":"parent","description":"<p>the ID, DOM node, or p5.Element\n of desired parent element</p>\n","type":"String|Object"}],"return":{"description":"","type":"p5.Element"},"example":["\n <div class=\"norender\"><code>\n // in the html file:\n &lt;div id=\"myContainer\">&lt;/div>\n // in the js file:\n var cnv = createCanvas(100, 100);\n cnv.parent(\"myContainer\");\n </code></div>\n <div class='norender'><code>\n var div0 = createDiv('this is the parent');\n var div1 = createDiv('this is the child');\n div1.parent(div0); // use p5.Element\n </code></div>\n <div class='norender'><code>\n var div0 = createDiv('this is the parent');\n div0.id('apples');\n var div1 = createDiv('this is the child');\n div1.parent('apples'); // use id\n </code></div>\n <div class='norender'><code>\n var elt = document.getElementById('myParentDiv');\n var div1 = createDiv('this is the child');\n div1.parent(elt); // use element from page\n </code></div>"],"class":"p5.Element","module":"DOM","submodule":"DOM"},{"file":"src/core/p5.Element.js","line":92,"description":"<p>Sets the ID of the element. If no ID argument is passed in, it instead\n returns the current ID of the element.</p>\n","itemtype":"method","name":"id","params":[{"name":"id","description":"<p>ID of the element</p>\n","type":"String","optional":true}],"return":{"description":"","type":"p5.Element|String"},"example":["\n <div><code class='norender'>\n function setup() {\n var cnv = createCanvas(100, 100);\n // Assigns a CSS selector ID to\n // the canvas element.\n cnv.id(\"mycanvas\");\n }\n </code></div>"],"class":"p5.Element","module":"DOM","submodule":"DOM"},{"file":"src/core/p5.Element.js","line":121,"description":"<p>Adds given class to the element. If no class argument is passed in, it\n instead returns a string containing the current class(es) of the element.</p>\n","itemtype":"method","name":"class","params":[{"name":"class","description":"<p>class to add</p>\n","type":"String","optional":true}],"return":{"description":"","type":"p5.Element|String"},"class":"p5.Element","module":"DOM","submodule":"DOM"},{"file":"src/core/p5.Element.js","line":139,"description":"<p>The .mousePressed() function is called once after every time a\nmouse button is pressed over the element. This can be used to\nattach element specific event listeners.</p>\n","itemtype":"method","name":"mousePressed","params":[{"name":"fxn","description":"<p>function to be fired when mouse is\n pressed over the element.</p>\n","type":"Function"}],"return":{"description":"","type":"p5.Element"},"example":["\n<div class='norender'><code>\nvar cnv;\nvar d;\nvar g;\nfunction setup() {\n cnv = createCanvas(100, 100);\n cnv.mousePressed(changeGray); // attach listener for\n // canvas click only\n d = 10;\n g = 100;\n}\n\nfunction draw() {\n background(g);\n ellipse(width/2, height/2, d, d);\n}\n\n// this function fires with any click anywhere\nfunction mousePressed() {\n d = d + 10;\n}\n\n// this function fires only when cnv is clicked\nfunction changeGray() {\n g = random(0, 255);\n}\n</code></div>\n"],"class":"p5.Element","module":"DOM","submodule":"DOM"},{"file":"src/core/p5.Element.js","line":184,"description":"<p>The .mouseWheel() function is called once after every time a\nmouse wheel is scrolled over the element. This can be used to\nattach element specific event listeners.<br><br>\nThe event.wheelDelta or event.detail property returns negative values if\nthe mouse wheel if rotated up or away from the user and positive in the\nother direction. On OS X with &quot;natural&quot; scrolling enabled, the values are\nopposite.</p>\n","itemtype":"method","name":"mouseWheel","params":[{"name":"fxn","description":"<p>function to be fired when mouse wheel is\n scrolled over the element.</p>\n","type":"Function"}],"return":{"description":"","type":"p5.Element"},"example":["\n<div class='norender'><code>\nvar cnv;\nvar d;\nvar g;\nfunction setup() {\n cnv = createCanvas(100, 100);\n cnv.mouseWheel(changeSize); // attach listener for\n // activity on canvas only\n d = 10;\n g = 100;\n}\n\nfunction draw() {\n background(g);\n ellipse(width/2, height/2, d, d);\n}\n\n// this function fires with mousewheel movement\n// anywhere on screen\nfunction mouseWheel() {\n g = g + 10;\n}\n\n// this function fires with mousewheel movement\n// over canvas only\nfunction changeSize() {\n if (event.wheelDelta > 0) {\n d = d + 10;\n } else {\n d = d - 10;\n }\n}\n</code></div>\n"],"class":"p5.Element","module":"DOM","submodule":"DOM"},{"file":"src/core/p5.Element.js","line":238,"description":"<p>The .mouseReleased() function is called once after every time a\nmouse button is released over the element. This can be used to\nattach element specific event listeners.</p>\n","itemtype":"method","name":"mouseReleased","params":[{"name":"fxn","description":"<p>function to be fired when mouse is\n released over the element.</p>\n","type":"Function"}],"return":{"description":"","type":"p5.Element"},"example":["\n<div class='norender'><code>\nvar cnv;\nvar d;\nvar g;\nfunction setup() {\n cnv = createCanvas(100, 100);\n cnv.mouseReleased(changeGray); // attach listener for\n // activity on canvas only\n d = 10;\n g = 100;\n}\n\nfunction draw() {\n background(g);\n ellipse(width/2, height/2, d, d);\n}\n\n// this function fires after the mouse has been\n// released\nfunction mouseReleased() {\n d = d + 10;\n}\n\n// this function fires after the mouse has been\n// released while on canvas\nfunction changeGray() {\n g = random(0, 255);\n}\n</code></div>\n"],"class":"p5.Element","module":"DOM","submodule":"DOM"},{"file":"src/core/p5.Element.js","line":286,"description":"<p>The .mouseClicked() function is called once after a mouse button is\npressed and released over the element. This can be used to\nattach element specific event listeners.</p>\n","itemtype":"method","name":"mouseClicked","params":[{"name":"fxn","description":"<p>function to be fired when mouse is\n clicked over the element.</p>\n","type":"Function"}],"return":{"description":"","type":"p5.Element"},"example":["\nvar cnv;\nvar d;\nvar g;\nfunction setup() {\n cnv = createCanvas(100, 100);\n cnv.mouseClicked(changeGray); // attach listener for\n // activity on canvas only\n d = 10;\n g = 100;\n}\n\nfunction draw() {\n background(g);\n ellipse(width/2, height/2, d, d);\n}\n\n// this function fires after the mouse has been\n// clicked anywhere\nfunction mouseClicked() {\n d = d + 10;\n}\n\n// this function fires after the mouse has been\n// clicked on canvas\nfunction changeGray() {\n g = random(0, 255);\n}\n</code></div>\n"],"class":"p5.Element","module":"DOM","submodule":"DOM"},{"file":"src/core/p5.Element.js","line":331,"description":"<p>The .mouseMoved() function is called once every time a\nmouse moves over the element. This can be used to attach an\nelement specific event listener.</p>\n","itemtype":"method","name":"mouseMoved","params":[{"name":"fxn","description":"<p>function to be fired when mouse is\n moved over the element.</p>\n","type":"Function"}],"return":{"description":"","type":"p5.Element"},"example":["\n<div class='norender'><code>\nvar cnv;\nvar d = 30;\nvar g;\nfunction setup() {\n cnv = createCanvas(100, 100);\n cnv.mouseMoved(changeSize); // attach listener for\n // activity on canvas only\n d = 10;\n g = 100;\n}\n\nfunction draw() {\n background(g);\n fill(200);\n ellipse(width/2, height/2, d, d);\n}\n\n// this function fires when mouse moves anywhere on\n// page\nfunction mouseMoved() {\n g = g + 5;\n if (g > 255) {\n g = 0;\n }\n}\n\n// this function fires when mouse moves over canvas\nfunction changeSize() {\n d = d + 2;\n if (d > 100) {\n d = 0;\n }\n}\n</code></div>\n"],"class":"p5.Element","module":"DOM","submodule":"DOM"},{"file":"src/core/p5.Element.js","line":384,"description":"<p>The .mouseOver() function is called once after every time a\nmouse moves onto the element. This can be used to attach an\nelement specific event listener.</p>\n","itemtype":"method","name":"mouseOver","params":[{"name":"fxn","description":"<p>function to be fired when mouse is\n moved over the element.</p>\n","type":"Function"}],"return":{"description":"","type":"p5.Element"},"example":["\n<div class='norender'><code>\nvar cnv;\nvar d;\nvar g;\nfunction setup() {\n cnv = createCanvas(100, 100);\n cnv.mouseOver(changeGray);\n d = 10;\n}\n\nfunction draw() {\n ellipse(width/2, height/2, d, d);\n}\n\nfunction changeGray() {\n d = d + 10;\n if (d > 100) {\n d = 0;\n }\n}\n</code></div>\n"],"class":"p5.Element","module":"DOM","submodule":"DOM"},{"file":"src/core/p5.Element.js","line":423,"description":"<p>The .changed() function is called when the value of an\nelement is changed.\nThis can be used to attach an element specific event listener.</p>\n","itemtype":"method","name":"changed","params":[{"name":"fxn","description":"<p>function to be fired when the value of an\nelement changes.</p>\n","type":"Function"}],"return":{"description":"","type":"p5.Element"},"example":["\n<div><code>\nvar sel;\n\nfunction setup() {\n textAlign(CENTER);\n background(200);\n sel = createSelect();\n sel.position(10, 10);\n sel.option('pear');\n sel.option('kiwi');\n sel.option('grape');\n sel.changed(mySelectEvent);\n}\n\nfunction mySelectEvent() {\n var item = sel.value();\n background(200);\n text(\"it's a \"+item+\"!\", 50, 50);\n}\n</code></div>\n<div><code>\nvar checkbox;\nvar cnv;\n\nfunction setup() {\n checkbox = createCheckbox(\" fill\");\n checkbox.changed(changeFill);\n cnv = createCanvas(100, 100);\n cnv.position(0, 30);\n noFill();\n}\n\nfunction draw() {\n background(200);\n ellipse(50, 50, 50, 50);\n}\n\nfunction changeFill() {\n if (checkbox.checked()) {\n fill(0);\n } else {\n noFill();\n }\n}\n</code></div>"],"class":"p5.Element","module":"DOM","submodule":"DOM"},{"file":"src/core/p5.Element.js","line":484,"description":"<p>The .input() function is called when any user input is\ndetected with an element. The input event is often used\nto detect keystrokes in a input element, or changes on a\nslider element. This can be used to attach an element specific\nevent listener.</p>\n","itemtype":"method","name":"input","params":[{"name":"fxn","description":"<p>function to be fired on user input.</p>\n","type":"Function"}],"return":{"description":"","type":"p5.Element"},"example":["\n<div class='norender'><code>\n// Open your console to see the output\nfunction setup() {\n var inp = createInput('');\n inp.input(myInputEvent);\n}\n\nfunction myInputEvent() {\n console.log('you are typing: ', this.value());\n}\n</code></div>\n"],"class":"p5.Element","module":"DOM","submodule":"DOM"},{"file":"src/core/p5.Element.js","line":513,"description":"<p>The .mouseOut() function is called once after every time a\nmouse moves off the element. This can be used to attach an\nelement specific event listener.</p>\n","itemtype":"method","name":"mouseOut","params":[{"name":"fxn","description":"<p>function to be fired when mouse is\n moved off the element.</p>\n","type":"Function"}],"return":{"description":"","type":"p5.Element"},"example":["\n<div class='norender'><code>\nvar cnv;\nvar d;\nvar g;\nfunction setup() {\n cnv = createCanvas(100, 100);\n cnv.mouseOut(changeGray);\n d = 10;\n}\n\nfunction draw() {\n ellipse(width/2, height/2, d, d);\n}\n\nfunction changeGray() {\n d = d + 10;\n if (d > 100) {\n d = 0;\n }\n}\n</code></div>\n"],"class":"p5.Element","module":"DOM","submodule":"DOM"},{"file":"src/core/p5.Element.js","line":551,"description":"<p>The .touchStarted() function is called once after every time a touch is\nregistered. This can be used to attach element specific event listeners.</p>\n","itemtype":"method","name":"touchStarted","params":[{"name":"fxn","description":"<p>function to be fired when touch is\n started over the element.</p>\n","type":"Function"}],"return":{"description":"","type":"p5.Element"},"example":["\n<div class='norender'><code>\nvar cnv;\nvar d;\nvar g;\nfunction setup() {\n cnv = createCanvas(100, 100);\n cnv.touchStarted(changeGray); // attach listener for\n // canvas click only\n d = 10;\n g = 100;\n}\n\nfunction draw() {\n background(g);\n ellipse(width/2, height/2, d, d);\n}\n\n// this function fires with any touch anywhere\nfunction touchStarted() {\n d = d + 10;\n}\n\n// this function fires only when cnv is clicked\nfunction changeGray() {\n g = random(0, 255);\n}\n</code></div>\n"],"class":"p5.Element","module":"DOM","submodule":"DOM"},{"file":"src/core/p5.Element.js","line":595,"description":"<p>The .touchMoved() function is called once after every time a touch move is\nregistered. This can be used to attach element specific event listeners.</p>\n","itemtype":"method","name":"touchMoved","params":[{"name":"fxn","description":"<p>function to be fired when touch is moved\n over the element.</p>\n","type":"Function"}],"return":{"description":"","type":"p5.Element"},"example":["\n<div class='norender'><code>\nvar cnv;\nvar g;\nfunction setup() {\n cnv = createCanvas(100, 100);\n cnv.touchMoved(changeGray); // attach listener for\n // canvas click only\n g = 100;\n}\n\nfunction draw() {\n background(g);\n}\n\n// this function fires only when cnv is clicked\nfunction changeGray() {\n g = random(0, 255);\n}\n</code></div>\n"],"class":"p5.Element","module":"DOM","submodule":"DOM"},{"file":"src/core/p5.Element.js","line":631,"description":"<p>The .touchEnded() function is called once after every time a touch is\nregistered. This can be used to attach element specific event listeners.</p>\n","itemtype":"method","name":"touchEnded","params":[{"name":"fxn","description":"<p>function to be fired when touch is\n ended over the element.</p>\n","type":"Function"}],"return":{"description":"","type":"p5.Element"},"example":["\n<div class='norender'><code>\nvar cnv;\nvar d;\nvar g;\nfunction setup() {\n cnv = createCanvas(100, 100);\n cnv.touchEnded(changeGray); // attach listener for\n // canvas click only\n d = 10;\n g = 100;\n}\n\nfunction draw() {\n background(g);\n ellipse(width/2, height/2, d, d);\n}\n\n// this function fires with any touch anywhere\nfunction touchEnded() {\n d = d + 10;\n}\n\n// this function fires only when cnv is clicked\nfunction changeGray() {\n g = random(0, 255);\n}\n</code></div>\n"],"class":"p5.Element","module":"DOM","submodule":"DOM"},{"file":"src/core/p5.Element.js","line":677,"description":"<p>The .dragOver() function is called once after every time a\nfile is dragged over the element. This can be used to attach an\nelement specific event listener.</p>\n","itemtype":"method","name":"dragOver","params":[{"name":"fxn","description":"<p>function to be fired when mouse is\n dragged over the element.</p>\n","type":"Function"}],"return":{"description":"","type":"p5.Element"},"class":"p5.Element","module":"DOM","submodule":"DOM"},{"file":"src/core/p5.Element.js","line":692,"description":"<p>The .dragLeave() function is called once after every time a\ndragged file leaves the element area. This can be used to attach an\nelement specific event listener.</p>\n","itemtype":"method","name":"dragLeave","params":[{"name":"fxn","description":"<p>function to be fired when mouse is\n dragged over the element.</p>\n","type":"Function"}],"return":{"description":"","type":"p5.Element"},"class":"p5.Element","module":"DOM","submodule":"DOM"},{"file":"src/core/p5.Element.js","line":707,"description":"<p>The .drop() function is called for each file dropped on the element.\nIt requires a callback that is passed a p5.File object. You can\noptionally pass two callbacks, the first one (required) is triggered\nfor each file dropped when the file is loaded. The second (optional)\nis triggered just once when a file (or files) are dropped.</p>\n","itemtype":"method","name":"drop","params":[{"name":"callback","description":"<p>triggered when files are dropped.</p>\n","type":"Function"},{"name":"callback","description":"<p>to receive loaded file.</p>\n","type":"Function"}],"return":{"description":"","type":"p5.Element"},"example":["\n<div><code>\nfunction setup() {\n var c = createCanvas(100, 100);\n background(200);\n textAlign(CENTER);\n text('drop image', width/2, height/2);\n c.drop(gotFile);\n}\n\nfunction gotFile(file) {\n var img = createImg(file.data).hide();\n // Draw the image onto the canvas\n image(img, 0, 0, width, height);\n}\n</code></div>"],"class":"p5.Element","module":"DOM","submodule":"DOM"},{"file":"src/core/p5.Element.js","line":811,"description":"<p>Helper fxn for sharing pixel methods</p>\n","class":"p5.Element","module":"DOM","submodule":"DOM"},{"file":"src/core/p5.Renderer.js","line":71,"description":"<p>Resize our canvas element.</p>\n","class":"p5.Renderer","module":"Rendering","submodule":"Rendering"},{"file":"src/core/p5.Renderer.js","line":145,"description":"<p>Helper fxn to check font type (system or otf)</p>\n","class":"p5.Renderer","module":"Rendering","submodule":"Rendering"},{"file":"src/core/p5.Renderer.js","line":201,"description":"<p>Helper fxn to measure ascent and descent.\nAdapted from <a href=\"http://stackoverflow.com/a/25355178\">http://stackoverflow.com/a/25355178</a></p>\n","class":"p5.Renderer","module":"Rendering","submodule":"Rendering"},{"file":"src/core/p5.Renderer2D.js","line":9,"description":"<p>p5.Renderer2D\nThe 2D graphics canvas renderer class.\nextends p5.Renderer</p>\n","class":"p5","module":"Rendering"},{"file":"src/core/p5.Renderer2D.js","line":356,"description":"<p>Generate a cubic Bezier representing an arc on the unit circle of total\nangle <code>size</code> radians, beginning <code>start</code> radians above the x-axis. Up to\nfour of these curves are combined to make a full arc.</p>\n<p>See www.joecridge.me/bezier.pdf for an explanation of the method.</p>\n","class":"p5","module":"Rendering"},{"file":"src/core/rendering.js","line":14,"description":"<p>Creates a canvas element in the document, and sets the dimensions of it\nin pixels. This method should be called only once at the start of setup.\nCalling createCanvas more than once in a sketch will result in very\nunpredicable behavior. If you want more than one drawing canvas\nyou could use createGraphics (hidden by default but it can be shown).\n<br><br>\nThe system variables width and height are set by the parameters passed\nto this function. If createCanvas() is not used, the window will be\ngiven a default size of 100x100 pixels.\n<br><br>\nFor more ways to position the canvas, see the\n<a href='https://github.com/processing/p5.js/wiki/Positioning-your-canvas'>\npositioning the canvas</a> wiki page.</p>\n","itemtype":"method","name":"createCanvas","params":[{"name":"w","description":"<p>width of the canvas</p>\n","type":"Number"},{"name":"h","description":"<p>height of the canvas</p>\n","type":"Number"},{"name":"renderer","description":"<p>P2D or WEBGL</p>\n","type":"Constant","optional":true}],"return":{"description":"canvas generated","type":"Object"},"example":["\n<div>\n<code>\nfunction setup() {\n createCanvas(100, 50);\n background(153);\n line(0, 0, width, height);\n}\n</code>\n</div>"],"class":"p5","module":"Rendering","submodule":"Rendering"},{"file":"src/core/rendering.js","line":115,"description":"<p>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.</p>\n","itemtype":"method","name":"resizeCanvas","example":["\n<div class=\"norender\"><code>\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</code></div>"],"class":"p5","module":"Rendering","submodule":"Rendering"},{"file":"src/core/rendering.js","line":158,"description":"<p>Removes the default canvas for a p5 sketch that doesn&#39;t\nrequire a canvas</p>\n","itemtype":"method","name":"noCanvas","example":["\n<div>\n<code>\nfunction setup() {\n noCanvas();\n}\n</code>\n</div>"],"class":"p5","module":"Rendering","submodule":"Rendering"},{"file":"src/core/rendering.js","line":177,"description":"<p>Creates and returns a new p5.Renderer 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.</p>\n","itemtype":"method","name":"createGraphics","params":[{"name":"w","description":"<p>width of the offscreen graphics buffer</p>\n","type":"Number"},{"name":"h","description":"<p>height of the offscreen graphics buffer</p>\n","type":"Number"},{"name":"renderer","description":"<p>P2D or WEBGL\nundefined defaults to p2d</p>\n","type":"Constant","optional":true}],"return":{"description":"offscreen graphics buffer","type":"Object"},"example":["\n<div>\n<code>\nvar pg;\nfunction setup() {\n createCanvas(100, 100);\n pg = createGraphics(100, 100);\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</code>\n</div>"],"class":"p5","module":"Rendering","submodule":"Rendering"},{"file":"src/core/rendering.js","line":211,"description":"<p>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):</p>\n<ul>\n<li><code>BLEND</code> - linear interpolation of colours: C =\nA<em>factor + B. This is the default blending mode.</li>\n<li><code>ADD</code> - sum of A and B</li>\n<li><code>DARKEST</code> - only the darkest colour succeeds: C =\nmin(A</em>factor, B).</li>\n<li><code>LIGHTEST</code> - only the lightest colour succeeds: C =\nmax(A*factor, B).</li>\n<li><code>DIFFERENCE</code> - subtract colors from underlying image.</li>\n<li><code>EXCLUSION</code> - similar to <code>DIFFERENCE</code>, but less\nextreme.</li>\n<li><code>MULTIPLY</code> - multiply the colors, result will always be\ndarker.</li>\n<li><code>SCREEN</code> - opposite multiply, uses inverse values of the\ncolors.</li>\n<li><code>REPLACE</code> - the pixels entirely replace the others and\ndon&#39;t utilize alpha (transparency) values.</li>\n<li><code>OVERLAY</code> - mix of <code>MULTIPLY</code> and <code>SCREEN\n</code>. Multiplies dark values, and screens light values.</li>\n<li><code>HARD_LIGHT</code> - <code>SCREEN</code> when greater than 50%\ngray, <code>MULTIPLY</code> when lower.</li>\n<li><code>SOFT_LIGHT</code> - mix of <code>DARKEST</code> and\n<code>LIGHTEST</code>. Works like <code>OVERLAY</code>, but not as harsh.\n</li>\n<li><code>DODGE</code> - lightens light tones and increases contrast,\nignores darks.</li>\n<li><code>BURN</code> - darker areas are applied, increasing contrast,\nignores lights.</li>\n</ul>","itemtype":"method","name":"blendMode","params":[{"name":"mode","description":"<p>blend mode to set for canvas</p>\n","type":"Constant"}],"example":["\n<div>\n<code>\nblendMode(LIGHTEST);\nstrokeWeight(30);\nstroke(80, 150, 255);\nline(25, 25, 75, 75);\nstroke(255, 50, 50);\nline(75, 25, 25, 75);\n</code>\n</div>\n<div>\n<code>\nblendMode(MULTIPLY);\nstrokeWeight(30);\nstroke(80, 150, 255);\nline(25, 25, 75, 75);\nstroke(255, 50, 50);\nline(75, 25, 25, 75);\n</code>\n</div>"],"class":"p5","module":"Rendering","submodule":"Rendering"},{"file":"src/core/shim.js","line":65,"description":"<p>shim for Uint8ClampedArray.slice\n(allows arrayCopy to work with pixels[])\nwith thanks to <a href=\"http://halfpapstudios.com/blog/tag/html5-canvas/\">http://halfpapstudios.com/blog/tag/html5-canvas/</a>\nEnumerable set to false to protect for...in from\nUint8ClampedArray.prototype pollution.</p>\n","class":"p5","module":"Rendering"},{"file":"src/core/structure.js","line":15,"description":"<p>Stops p5.js from continuously executing the code within draw().\nIf loop() is called, the code in draw() begins to run continuously again.\nIf using noLoop() in setup(), it should be the last line inside the block.\n<br><br>\nWhen noLoop() is used, it&#39;s not possible to manipulate or access the\nscreen inside event handling functions such as mousePressed() or\nkeyPressed(). Instead, use those functions to call redraw() or loop(),\nwhich will run draw(), which can update the screen properly. This means\nthat when noLoop() has been called, no drawing can happen, and functions\nlike saveFrame() or loadPixels() may not be used.\n<br><br>\nNote that if the sketch is resized, redraw() will be called to update\nthe sketch, even after noLoop() has been specified. Otherwise, the sketch\nwould enter an odd state until loop() was called.</p>\n","itemtype":"method","name":"noLoop","example":["\n<div><code>\nfunction setup() {\n createCanvas(100, 100);\n background(200);\n noLoop();\n}\n\nfunction draw() {\n line(10, 10, 90, 90);\n}\n</code></div>\n\n<div><code>\nvar 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</code></div>"],"class":"p5","module":"Structure","submodule":"Structure"},{"file":"src/core/structure.js","line":72,"description":"<p>By default, p5.js loops through draw() continuously, executing the code\nwithin it. However, the draw() loop may be stopped by calling noLoop().\nIn that case, the draw() loop can be resumed with loop().</p>\n","itemtype":"method","name":"loop","example":["\n<div><code>\nvar 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</code></div>"],"class":"p5","module":"Structure","submodule":"Structure"},{"file":"src/core/structure.js","line":110,"description":"<p>The push() function saves the current drawing style settings and\ntransformations, while pop() restores these settings. Note that these\nfunctions are always used together. They allow you to change the style\nand transformation settings and later return to what you had. When a new\nstate is started with push(), it builds on the current style and transform\ninformation. The push() and pop() functions can be embedded to provide\nmore control. (See the second example for a demonstration.)\n<br><br>\npush() stores information related to the current transformation state\nand style settings controlled by the following functions: fill(),\nstroke(), tint(), strokeWeight(), strokeCap(), strokeJoin(),\nimageMode(), rectMode(), ellipseMode(), colorMode(), textAlign(),\ntextFont(), textMode(), textSize(), textLeading().</p>\n","itemtype":"method","name":"push","example":["\n<div>\n<code>\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</code>\n</div>\n<div>\n<code>\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</code>\n</div>"],"class":"p5","module":"Structure","submodule":"Structure"},{"file":"src/core/structure.js","line":180,"description":"<p>The push() function saves the current drawing style settings and\ntransformations, while pop() restores these settings. Note that these\nfunctions are always used together. They allow you to change the style\nand transformation settings and later return to what you had. When a new\nstate is started with push(), it builds on the current style and transform\ninformation. The push() and pop() functions can be embedded to provide\nmore control. (See the second example for a demonstration.)\n<br><br>\npush() stores information related to the current transformation state\nand style settings controlled by the following functions: fill(),\nstroke(), tint(), strokeWeight(), strokeCap(), strokeJoin(),\nimageMode(), rectMode(), ellipseMode(), colorMode(), textAlign(),\ntextFont(), textMode(), textSize(), textLeading().</p>\n","itemtype":"method","name":"pop","example":["\n<div>\n<code>\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</code>\n</div>\n<div>\n<code>\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</code>\n</div>"],"class":"p5","module":"Structure","submodule":"Structure"},{"file":"src/core/structure.js","line":247,"description":"<p>Executes the code within draw() one time. This functions allows the\n program to update the display window only when necessary, for example\n when an event registered by mousePressed() or keyPressed() occurs.\n <br><br>\n In structuring a program, it only makes sense to call redraw() within\n events such as mousePressed(). This is because redraw() does not run\n draw() immediately (it only sets a flag that indicates an update is\n needed).\n <br><br>\n The redraw() function does not work properly when called inside draw().\n To enable/disable animations, use loop() and noLoop().\n <br><br>\n In addition you can set the number of redraws per method call. Just\n add an integer as single parameter for the number of redraws.</p>\n","itemtype":"method","name":"redraw","params":[{"name":"n","description":"<p>Redraw for n-times. The default value is 1.</p>\n","type":"Integer","optional":true}],"example":["\n <div><code>\n var x = 0;\nfunction setup() {\n createCanvas(100, 100);\n noLoop();\n }\nfunction draw() {\n background(204);\n line(x, 0, x, height);\n }\nfunction mousePressed() {\n x += 1;\n redraw();\n }\n </code></div>\n<div><code>\n var x = 0;\nfunction setup() {\n createCanvas(100, 100);\n noLoop();\n }\nfunction draw() {\n background(204);\n x += 1;\n line(x, 0, x, height);\n }\nfunction mousePressed() {\n redraw(5);\n }\n </code></div>"],"class":"p5","module":"Structure","submodule":"Structure"},{"file":"src/core/transform.js","line":15,"description":"<p>Multiplies the current matrix by the one specified through the parameters.\nThis is very slow because it will try to calculate the inverse of the\ntransform, so avoid it whenever possible.</p>\n","itemtype":"method","name":"applyMatrix","params":[{"name":"n00","description":"<p>numbers which define the 3x2 matrix to be multiplied</p>\n","type":"Number"},{"name":"n01","description":"<p>numbers which define the 3x2 matrix to be multiplied</p>\n","type":"Number"},{"name":"n02","description":"<p>numbers which define the 3x2 matrix to be multiplied</p>\n","type":"Number"},{"name":"n10","description":"<p>numbers which define the 3x2 matrix to be multiplied</p>\n","type":"Number"},{"name":"n11","description":"<p>numbers which define the 3x2 matrix to be multiplied</p>\n","type":"Number"},{"name":"n12","description":"<p>numbers which define the 3x2 matrix to be multiplied</p>\n","type":"Number"}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\n// Example in the works.\n</code>\n</div>"],"class":"p5","module":"Transform","submodule":"Transform"},{"file":"src/core/transform.js","line":52,"description":"<p>Replaces the current matrix with the identity matrix.</p>\n","itemtype":"method","name":"resetMatrix","return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\n// Example in the works.\n</code>\n</div>"],"class":"p5","module":"Transform","submodule":"Transform"},{"file":"src/core/transform.js","line":69,"description":"<p>Rotates a shape the amount specified by the angle parameter. This\nfunction accounts for angleMode, so angles can be entered in either\nRADIANS or DEGREES.\n<br><br>\nObjects 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 accumulates the effect. For example, calling\nrotate(HALF_PI) and then rotate(HALF_PI) is the same as rotate(PI).\nAll tranformations are reset when draw() begins again.\n<br><br>\nTechnically, rotate() multiplies the current transformation matrix\nby a rotation matrix. This function can be further controlled by\nthe push() and pop().</p>\n","itemtype":"method","name":"rotate","return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\ntranslate(width/2, height/2);\nrotate(PI/3.0);\nrect(-26, -26, 52, 52);\n</code>\n</div>"],"class":"p5","module":"Transform","submodule":"Transform","overloads":[{"line":69,"params":[{"name":"angle","description":"<p>the angle of rotation, specified in radians\n or degrees, depending on current angleMode</p>\n","type":"Number"}]},{"line":98,"params":[{"name":"rad","description":"<p>angle in radians</p>\n","type":"Number"},{"name":"axis","description":"<p>axis to rotate around</p>\n","type":"p5.Vector | Array"}]}]},{"file":"src/core/transform.js","line":125,"description":"<p>Rotates around X axis.</p>\n","itemtype":"method","name":"rotateX","params":[{"name":"rad","description":"<p>angles in radians</p>\n","type":"Number"}],"return":{"description":"[description]","type":"[type]"},"class":"p5","module":"Transform","submodule":"Transform"},{"file":"src/core/transform.js","line":151,"description":"<p>Rotates around Y axis.</p>\n","itemtype":"method","name":"rotateY","params":[{"name":"rad","description":"<p>angles in radians</p>\n","type":"Number"}],"return":{"description":"[description]","type":"[type]"},"class":"p5","module":"Transform","submodule":"Transform"},{"file":"src/core/transform.js","line":177,"description":"<p>Rotates around Z axis. Webgl mode only.</p>\n","itemtype":"method","name":"rotateZ","params":[{"name":"rad","description":"<p>angles in radians</p>\n","type":"Number"}],"return":{"description":"[description]","type":"[type]"},"class":"p5","module":"Transform","submodule":"Transform"},{"file":"src/core/transform.js","line":203,"description":"<p>Increases or decreases the size of a shape by expanding and contracting\nvertices. Objects always scale from their relative origin to the\ncoordinate system. Scale values are specified as decimal percentages.\nFor example, the function call scale(2.0) increases the dimension of a\nshape by 200%.\n<br><br>\nTransformations apply to everything that happens after and subsequent\ncalls to the function multiply the effect. For example, calling scale(2.0)\nand then scale(1.5) is the same as scale(3.0). If scale() is called\nwithin draw(), the transformation is reset when the loop begins again.\n<br><br>\nUsing this function with the z parameter is only available in WEBGL mode.\nThis function can be further controlled with push() and pop().</p>\n","itemtype":"method","name":"scale","params":[{"name":"s","description":"<p>percent to scale the object, or percentage to\n scale the object in the x-axis if multiple arguments\n are given</p>\n","type":"Number | p5.Vector | Array"},{"name":"y","description":"<p>percent to scale the object in the y-axis</p>\n","type":"Number","optional":true},{"name":"z","description":"<p>percent to scale the object in the z-axis (webgl only)</p>\n","type":"Number","optional":true}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\ntranslate(width/2, height/2);\nrotate(PI/3.0);\nrect(-26, -26, 52, 52);\n</code>\n</div>\n\n<div>\n<code>\nrect(30, 20, 50, 50);\nscale(0.5, 1.3);\nrect(30, 20, 50, 50);\n</code>\n</div>"],"class":"p5","module":"Transform","submodule":"Transform"},{"file":"src/core/transform.js","line":279,"description":"<p>Shears a shape around the x-axis the amount specified by the angle\nparameter. Angles should be specified in the current angleMode.\nObjects are always sheared around their relative position to the origin\nand positive numbers shear objects in a clockwise direction.\n<br><br>\nTransformations apply to everything that happens after and subsequent\ncalls to the function accumulates the effect. For example, calling\nshearX(PI/2) and then shearX(PI/2) is the same as shearX(PI).\nIf shearX() is called within the draw(), the transformation is reset when\nthe loop begins again.\n<br><br>\nTechnically, shearX() multiplies the current transformation matrix by a\nrotation matrix. This function can be further controlled by the\npush() and pop() functions.</p>\n","itemtype":"method","name":"shearX","params":[{"name":"angle","description":"<p>angle of shear specified in radians or degrees,\n depending on current angleMode</p>\n","type":"Number"}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\ntranslate(width/4, height/4);\nshearX(PI/4.0);\nrect(0, 0, 30, 30);\n</code>\n</div>"],"class":"p5","module":"Transform","submodule":"Transform"},{"file":"src/core/transform.js","line":316,"description":"<p>Shears a shape around the y-axis the amount specified by the angle\nparameter. Angles should be specified in the current angleMode. Objects\nare always sheared around their relative position to the origin and\npositive numbers shear objects in a clockwise direction.\n<br><br>\nTransformations apply to everything that happens after and subsequent\ncalls to the function accumulates the effect. For example, calling\nshearY(PI/2) and then shearY(PI/2) is the same as shearY(PI). If\nshearY() is called within the draw(), the transformation is reset when\nthe loop begins again.\n<br><br>\nTechnically, shearY() multiplies the current transformation matrix by a\nrotation matrix. This function can be further controlled by the\npush() and pop() functions.</p>\n","itemtype":"method","name":"shearY","params":[{"name":"angle","description":"<p>angle of shear specified in radians or degrees,\n depending on current angleMode</p>\n","type":"Number"}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\ntranslate(width/4, height/4);\nshearY(PI/4.0);\nrect(0, 0, 30, 30);\n</code>\n</div>"],"class":"p5","module":"Transform","submodule":"Transform"},{"file":"src/core/transform.js","line":353,"description":"<p>Specifies an amount to displace objects within the display window.\nThe x parameter specifies left/right translation, the y parameter\nspecifies up/down translation.\n<br><br>\nTransformations are cumulative and apply to everything that happens after\nand subsequent calls to the function accumulates the effect. For example,\ncalling translate(50, 0) and then translate(20, 0) is the same as\ntranslate(70, 0). If translate() is called within draw(), the\ntransformation is reset when the loop begins again. This function can be\nfurther controlled by using push() and pop().</p>\n","itemtype":"method","name":"translate","params":[{"name":"x","description":"<p>left/right translation</p>\n","type":"Number"},{"name":"y","description":"<p>up/down translation</p>\n","type":"Number"},{"name":"z","description":"<p>forward/backward translation (webgl only)</p>\n","type":"Number","optional":true}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\ntranslate(30, 20);\nrect(0, 0, 55, 55);\n</code>\n</div>\n\n<div>\n<code>\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</code>\n</div>"],"class":"p5","module":"Transform","submodule":"Transform"},{"file":"src/core/vertex.js","line":22,"description":"<p>Use the beginContour() and endContour() functions to create negative\nshapes within shapes such as the center of the letter &#39;O&#39;. beginContour()\nbegins recording vertices for the shape and endContour() stops recording.\nThe vertices that define a negative shape must &quot;wind&quot; in the opposite\ndirection from the exterior shape. First draw vertices for the exterior\nclockwise order, then for internal shapes, draw vertices\nshape in counter-clockwise.\n<br><br>\nThese functions can only be used within a beginShape()/endShape() pair and\ntransformations such as translate(), rotate(), and scale() do not work\nwithin a beginContour()/endContour() pair. It is also not possible to use\nother shapes, such as ellipse() or rect() within.</p>\n","itemtype":"method","name":"beginContour","return":{"description":"the p5 object","type":"Object"},"example":["\n<div>\n<code>\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</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Vertex"},{"file":"src/core/vertex.js","line":66,"description":"<p>Using the beginShape() and endShape() functions allow creating more\ncomplex forms. beginShape() begins recording vertices for a shape and\nendShape() stops recording. The value of the kind parameter tells it which\ntypes of shapes to create from the provided vertices. With no mode\nspecified, the shape can be any irregular polygon.\n<br><br>\nThe parameters available for beginShape() are POINTS, LINES, TRIANGLES,\nTRIANGLE_FAN, TRIANGLE_STRIP, QUADS, and QUAD_STRIP. After calling the\nbeginShape() function, a series of vertex() commands must follow. To stop\ndrawing the shape, call endShape(). Each shape will be outlined with the\ncurrent stroke color and filled with the fill color.\n<br><br>\nTransformations such as translate(), rotate(), and scale() do not work\nwithin beginShape(). It is also not possible to use other shapes, such as\nellipse() or rect() within beginShape().</p>\n","itemtype":"method","name":"beginShape","params":[{"name":"kind","description":"<p>either POINTS, LINES, TRIANGLES, TRIANGLE_FAN\n TRIANGLE_STRIP, QUADS, or QUAD_STRIP</p>\n","type":"Constant"}],"return":{"description":"the p5 object","type":"Object"},"example":["\n<div>\n<code>\nbeginShape();\nvertex(30, 20);\nvertex(85, 20);\nvertex(85, 75);\nvertex(30, 75);\nendShape(CLOSE);\n</code>\n</div>\n\n<div>\n<code>\n// currently not working\nbeginShape(POINTS);\nvertex(30, 20);\nvertex(85, 20);\nvertex(85, 75);\nvertex(30, 75);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\nbeginShape(LINES);\nvertex(30, 20);\nvertex(85, 20);\nvertex(85, 75);\nvertex(30, 75);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\nnoFill();\nbeginShape();\nvertex(30, 20);\nvertex(85, 20);\nvertex(85, 75);\nvertex(30, 75);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\nnoFill();\nbeginShape();\nvertex(30, 20);\nvertex(85, 20);\nvertex(85, 75);\nvertex(30, 75);\nendShape(CLOSE);\n</code>\n</div>\n\n<div>\n<code>\nbeginShape(TRIANGLES);\nvertex(30, 75);\nvertex(40, 20);\nvertex(50, 75);\nvertex(60, 20);\nvertex(70, 75);\nvertex(80, 20);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\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</code>\n</div>\n\n<div>\n<code>\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</code>\n</div>\n\n<div>\n<code>\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</code>\n</div>\n\n<div>\n<code>\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</code>\n</div>\n\n<div>\n<code>\nbeginShape();\nvertex(20, 20);\nvertex(40, 20);\nvertex(40, 40);\nvertex(60, 40);\nvertex(60, 60);\nvertex(20, 60);\nendShape(CLOSE);\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Vertex"},{"file":"src/core/vertex.js","line":250,"description":"<p>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.\n<br><br>\nThe first time bezierVertex() is used within a\nbeginShape() call, it must be prefaced with a call to vertex()\nto set the first anchor point. This function must be used between\nbeginShape() and endShape() and only when there is no MODE\nparameter specified to beginShape().</p>\n","itemtype":"method","name":"bezierVertex","params":[{"name":"x2","description":"<p>x-coordinate for the first control point</p>\n","type":"Number"},{"name":"y2","description":"<p>y-coordinate for the first control point</p>\n","type":"Number"},{"name":"x3","description":"<p>x-coordinate for the second control point</p>\n","type":"Number"},{"name":"y3","description":"<p>y-coordinate for the second control point</p>\n","type":"Number"},{"name":"x4","description":"<p>x-coordinate for the anchor point</p>\n","type":"Number"},{"name":"y4","description":"<p>y-coordinate for the anchor point</p>\n","type":"Number"}],"return":{"description":"the p5 object","type":"Object"},"example":["\n<div>\n<code>\nnoFill();\nbeginShape();\nvertex(30, 20);\nbezierVertex(80, 0, 80, 75, 30, 75);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\nbeginShape();\nvertex(30, 20);\nbezierVertex(80, 0, 80, 75, 30, 75);\nbezierVertex(50, 80, 60, 25, 30, 20);\nendShape();\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Vertex"},{"file":"src/core/vertex.js","line":310,"description":"<p>Specifies vertex coordinates for curves. This function may only\nbe used between beginShape() and endShape() and only when there\nis no MODE parameter specified to beginShape().\n<br><br>\nThe first and last points in a series of curveVertex() lines will be used to\nguide the beginning and end of a 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.</p>\n","itemtype":"method","name":"curveVertex","params":[{"name":"x","description":"<p>x-coordinate of the vertex</p>\n","type":"Number"},{"name":"y","description":"<p>y-coordinate of the vertex</p>\n","type":"Number"}],"return":{"description":"the p5 object","type":"Object"},"example":["\n<div>\n<code>\nnoFill();\nbeginShape();\ncurveVertex(84, 91);\ncurveVertex(84, 91);\ncurveVertex(68, 19);\ncurveVertex(21, 17);\ncurveVertex(32, 100);\ncurveVertex(32, 100);\nendShape();\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Vertex"},{"file":"src/core/vertex.js","line":348,"description":"<p>Use the beginContour() and endContour() functions to create negative\nshapes within shapes such as the center of the letter &#39;O&#39;. beginContour()\nbegins recording vertices for the shape and endContour() stops recording.\nThe vertices that define a negative shape must &quot;wind&quot; in the opposite\ndirection from the exterior shape. First draw vertices for the exterior\nclockwise order, then for internal shapes, draw vertices\nshape in counter-clockwise.\n<br><br>\nThese functions can only be used within a beginShape()/endShape() pair and\ntransformations such as translate(), rotate(), and scale() do not work\nwithin a beginContour()/endContour() pair. It is also not possible to use\nother shapes, such as ellipse() or rect() within.</p>\n","itemtype":"method","name":"endContour","return":{"description":"the p5 object","type":"Object"},"example":["\n<div>\n<code>\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</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Vertex"},{"file":"src/core/vertex.js","line":404,"description":"<p>The endShape() function is the companion to beginShape() and may only be\ncalled after beginShape(). When endshape() is called, all of image data\ndefined since the previous call to beginShape() is written into the image\nbuffer. The constant CLOSE as the value for the MODE parameter to close\nthe shape (to connect the beginning and the end).</p>\n","itemtype":"method","name":"endShape","params":[{"name":"mode","description":"<p>use CLOSE to close the shape</p>\n","type":"Constant"}],"return":{"description":"the p5 object","type":"Object"},"example":["\n<div>\n<code>\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</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Vertex"},{"file":"src/core/vertex.js","line":468,"description":"<p>Specifies vertex coordinates for quadratic Bezier curves. Each call to\nquadraticVertex() defines the position of one control points and one\nanchor point of a Bezier curve, adding a new segment to a line or shape.\nThe first time quadraticVertex() is used within a beginShape() call, it\nmust be prefaced with a call to vertex() to set the first anchor point.\nThis function must be used between beginShape() and endShape() and only\nwhen there is no MODE parameter specified to beginShape().</p>\n","itemtype":"method","name":"quadraticVertex","params":[{"name":"cx","description":"<p>x-coordinate for the control point</p>\n","type":"Number"},{"name":"cy","description":"<p>y-coordinate for the control point</p>\n","type":"Number"},{"name":"x3","description":"<p>x-coordinate for the anchor point</p>\n","type":"Number"},{"name":"y3","description":"<p>y-coordinate for the anchor point</p>\n","type":"Number"}],"return":{"description":"the p5 object","type":"Object"},"example":["\n<div>\n<code>\nnoFill();\nstrokeWeight(4);\nbeginShape();\nvertex(20, 20);\nquadraticVertex(80, 20, 50, 50);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\nnoFill();\nstrokeWeight(4);\nbeginShape();\nvertex(20, 20);\nquadraticVertex(80, 20, 50, 50);\nquadraticVertex(20, 80, 80, 80);\nvertex(80, 60);\nendShape();\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Vertex"},{"file":"src/core/vertex.js","line":540,"description":"<p>All shapes are constructed by connecting a series of vertices. vertex()\nis used to specify the vertex coordinates for points, lines, triangles,\nquads, and polygons. It is used exclusively within the beginShape() and\nendShape() functions.</p>\n","itemtype":"method","name":"vertex","params":[{"name":"x","description":"<p>x-coordinate of the vertex</p>\n","type":"Number"},{"name":"y","description":"<p>y-coordinate of the vertex</p>\n","type":"Number"}],"return":{"description":"the p5 object","type":"Object"},"example":["\n<div>\n<code>\nbeginShape(POINTS);\nvertex(30, 20);\nvertex(85, 20);\nvertex(85, 75);\nvertex(30, 75);\nendShape();\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"Vertex"},{"file":"src/events/acceleration.js","line":12,"description":"<p>The system variable deviceOrientation always contains the orientation of\nthe device. The value of this variable will either be set &#39;landscape&#39;\nor &#39;portrait&#39;. If no data is available it will be set to &#39;undefined&#39;.</p>\n","itemtype":"property","name":"deviceOrientation","class":"p5","module":"Events","submodule":"Acceleration"},{"file":"src/events/acceleration.js","line":21,"description":"<p>The system variable accelerationX always contains the acceleration of the\ndevice along the x axis. Value is represented as meters per second squared.</p>\n","itemtype":"property","name":"accelerationX","class":"p5","module":"Events","submodule":"Acceleration"},{"file":"src/events/acceleration.js","line":29,"description":"<p>The system variable accelerationY always contains the acceleration of the\ndevice along the y axis. Value is represented as meters per second squared.</p>\n","itemtype":"property","name":"accelerationY","class":"p5","module":"Events","submodule":"Acceleration"},{"file":"src/events/acceleration.js","line":37,"description":"<p>The system variable accelerationZ always contains the acceleration of the\ndevice along the z axis. Value is represented as meters per second squared.</p>\n","itemtype":"property","name":"accelerationZ","class":"p5","module":"Events","submodule":"Acceleration"},{"file":"src/events/acceleration.js","line":45,"description":"<p>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.</p>\n","itemtype":"property","name":"pAccelerationX","class":"p5","module":"Events","submodule":"Acceleration"},{"file":"src/events/acceleration.js","line":54,"description":"<p>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.</p>\n","itemtype":"property","name":"pAccelerationY","class":"p5","module":"Events","submodule":"Acceleration"},{"file":"src/events/acceleration.js","line":63,"description":"<p>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.</p>\n","itemtype":"property","name":"pAccelerationZ","class":"p5","module":"Events","submodule":"Acceleration"},{"file":"src/events/acceleration.js","line":72,"description":"<p>_updatePAccelerations updates the pAcceleration values</p>\n","access":"private","tagname":"","class":"p5","module":"Events","submodule":"Acceleration"},{"file":"src/events/acceleration.js","line":83,"description":"<p>The system variable rotationX always contains the rotation of the\ndevice along the x axis. Value is represented as 0 to +/-180 degrees.\n<br><br>\nNote: 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.</p>\n","example":["\n<div>\n<code>\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}\n</code>\n</div>"],"itemtype":"property","name":"rotationX","class":"p5","module":"Events","submodule":"Acceleration"},{"file":"src/events/acceleration.js","line":112,"description":"<p>The system variable rotationY always contains the rotation of the\ndevice along the y axis. Value is represented as 0 to +/-90 degrees.\n<br><br>\nNote: 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.</p>\n","example":["\n<div>\n<code>\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}\n</code>\n</div>"],"itemtype":"property","name":"rotationY","class":"p5","module":"Events","submodule":"Acceleration"},{"file":"src/events/acceleration.js","line":141,"description":"<p>The system variable rotationZ always contains the rotation of the\ndevice along the z axis. Value is represented as 0 to 359 degrees.\n<br><br>\nUnlike rotationX and rotationY, this variable is available for devices\nwith a built-in compass only.\n<br><br>\nNote: 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.</p>\n","example":["\n<div>\n<code>\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}\n</code>\n</div>"],"itemtype":"property","name":"rotationZ","class":"p5","module":"Events","submodule":"Acceleration"},{"file":"src/events/acceleration.js","line":173,"description":"<p>The system variable pRotationX always contains the rotation of the\ndevice along the x axis in the frame previous to the current frame. Value\nis represented as 0 to +/-180 degrees.\n<br><br>\npRotationX can also be used with rotationX to determine the rotate\ndirection of the device along the X-axis.</p>\n","example":["\n<div class='norender'>\n<code>\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.\nvar rotateDirection = 'clockwise';\n\n// Simple range conversion to make things simpler.\n// This is not absolutely neccessary but the logic\n// will be different in that case.\n\nvar rX = rotationX + 180;\nvar 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</code>\n</div>"],"itemtype":"property","name":"pRotationX","class":"p5","module":"Events","submodule":"Acceleration"},{"file":"src/events/acceleration.js","line":211,"description":"<p>The system variable pRotationY always contains the rotation of the\ndevice along the y axis in the frame previous to the current frame. Value\nis represented as 0 to +/-90 degrees.\n<br><br>\npRotationY can also be used with rotationY to determine the rotate\ndirection of the device along the Y-axis.</p>\n","example":["\n<div class='norender'>\n<code>\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.\nvar rotateDirection = 'clockwise';\n\n// Simple range conversion to make things simpler.\n// This is not absolutely neccessary but the logic\n// will be different in that case.\n\nvar rY = rotationY + 180;\nvar 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}\n</code>\n</div>"],"itemtype":"property","name":"pRotationY","class":"p5","module":"Events","submodule":"Acceleration"},{"file":"src/events/acceleration.js","line":249,"description":"<p>The system variable pRotationZ always contains the rotation of the\ndevice along the z axis in the frame previous to the current frame. Value\nis represented as 0 to 359 degrees.\n<br><br>\npRotationZ can also be used with rotationZ to determine the rotate\ndirection of the device along the Z-axis.</p>\n","example":["\n<div class='norender'>\n<code>\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.\nvar rotateDirection = 'clockwise';\n\nif ((rotationZ - pRotationZ > 0 &&\n rotationZ - pRotationZ < 270)||\n rotationZ - pRotationZ < -270){\n\n rotateDirection = 'clockwise';\n\n} else if (rotationZ - pRotationZ < 0 ||\n rotationZ - pRotationZ > 270){\n\n rotateDirection = 'counter-clockwise';\n\n}\n</code>\n</div>"],"itemtype":"property","name":"pRotationZ","class":"p5","module":"Events","submodule":"Acceleration"},{"file":"src/events/acceleration.js","line":310,"description":"<p>The setMoveThreshold() function is used to set the movement threshold for\nthe deviceMoved() function. The default threshold is set to 0.5.</p>\n","itemtype":"method","name":"setMoveThreshold","params":[{"name":"value","description":"<p>The threshold value</p>\n","type":"Number"}],"class":"p5","module":"Events","submodule":"Acceleration"},{"file":"src/events/acceleration.js","line":323,"description":"<p>The setShakeThreshold() function is used to set the movement threshold for\nthe deviceShaken() function. The default threshold is set to 30.</p>\n","itemtype":"method","name":"setShakeThreshold","params":[{"name":"value","description":"<p>The threshold value</p>\n","type":"Number"}],"class":"p5","module":"Events","submodule":"Acceleration"},{"file":"src/events/acceleration.js","line":336,"description":"<p>The deviceMoved() function is called when the device is moved by more than\nthe threshold value along X, Y or Z axis. The default threshold is set to\n0.5.</p>\n","itemtype":"method","name":"deviceMoved","example":["\n<div>\n<code>\n// Run this example on a mobile device\n// Move the device around\n// to change the value.\n\nvar value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n}\nfunction deviceMoved() {\n value = value + 5;\n if (value > 255) {\n value = 0;\n }\n}\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Acceleration"},{"file":"src/events/acceleration.js","line":363,"description":"<p>The deviceTurned() function is called when the device rotates by\nmore than 90 degrees continuously.\n<br><br>\nThe axis that triggers the deviceTurned() method is stored in the turnAxis\nvariable. The deviceTurned() method can be locked to trigger on any axis:\nX, Y or Z by comparing the turnAxis variable to &#39;X&#39;, &#39;Y&#39; or &#39;Z&#39;.</p>\n","itemtype":"method","name":"deviceTurned","example":["\n<div>\n<code>\n// Run this example on a mobile device\n// Rotate the device by 90 degrees\n// to change the value.\n\nvar value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n}\nfunction deviceTurned() {\n if (value == 0){\n value = 255\n } else if (value == 255) {\n value = 0;\n }\n}\n</code>\n</div>\n<div>\n<code>\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\nvar value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\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</code>\n</div>"],"class":"p5","module":"Events","submodule":"Acceleration"},{"file":"src/events/acceleration.js","line":417,"description":"<p>The deviceShaken() function is called when the device total acceleration\nchanges of accelerationX and accelerationY values is more than\nthe threshold value. The default threshold is set to 30.</p>\n","itemtype":"method","name":"deviceShaken","example":["\n<div>\n<code>\n// Run this example on a mobile device\n// Shake the device to change the value.\n\nvar value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n}\nfunction deviceShaken() {\n value = value + 5;\n if (value > 255) {\n value = 0;\n }\n}\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Acceleration"},{"file":"src/events/keyboard.js","line":12,"description":"<p>Holds the key codes of currently pressed keys.</p>\n","access":"private","tagname":"","class":"p5","module":"Events","submodule":"Keyboard"},{"file":"src/events/keyboard.js","line":18,"description":"<p>The boolean system variable keyIsPressed is true if any key is pressed\nand false if no keys are pressed.</p>\n","itemtype":"property","name":"keyIsPressed","example":["\n<div>\n<code>\nvar value = 0;\nfunction draw() {\n if (keyIsPressed === true) {\n fill(0);\n } else {\n fill(255);\n }\n rect(25, 25, 50, 50);\n}\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Keyboard"},{"file":"src/events/keyboard.js","line":41,"description":"<p>The system variable key always contains the value of the most recent\nkey on the keyboard that was typed. To get the proper capitalization, it\nis best to use it within keyTyped(). For non-ASCII keys, use the keyCode\nvariable.</p>\n","itemtype":"property","name":"key","example":["\n<div><code>\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}\n</div></code>"],"class":"p5","module":"Events","submodule":"Keyboard"},{"file":"src/events/keyboard.js","line":65,"description":"<p>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.</p>\n","itemtype":"property","name":"keyCode","example":["\n<div><code>\nvar fillVal = 126;\nfunction draw() {\n fill(fillVal);\n rect(25, 25, 50, 50);\n}\n\nfunction keyPressed() {\n if (keyCode == UP_ARROW) {\n fillVal = 255;\n } else if (keyCode == DOWN_ARROW) {\n fillVal = 0;\n }\n return false; // prevent default\n}\n</code></div>"],"class":"p5","module":"Events","submodule":"Keyboard"},{"file":"src/events/keyboard.js","line":91,"description":"<p>The keyPressed() function is called once every time a key is pressed. The\nkeyCode for the key that was pressed is stored in the keyCode variable.\n<br><br>\nFor non-ASCII keys, use the keyCode variable. You can check if the keyCode\nequals BACKSPACE, DELETE, ENTER, RETURN, TAB, ESCAPE, SHIFT, CONTROL,\nOPTION, ALT, UP_ARROW, DOWN_ARROW, LEFT_ARROW, RIGHT_ARROW.\n<br><br>\nFor ASCII keys that was pressed is stored in the key variable. However, it\ndoes not distinguish between uppercase and lowercase. For this reason, it\nis recommended to use keyTyped() to read the key variable, in which the\ncase of the variable will be distinguished.\n<br><br>\nBecause of how operating systems handle key repeats, holding down a key\nmay cause multiple calls to keyTyped() (and keyReleased() as well). The\nrate of repeat is set by the operating system and how each computer is\nconfigured.<br><br>\nBrowsers may have different default\nbehaviors attached to various key events. To prevent any default\nbehavior for this event, add &quot;return false&quot; to the end of the method.</p>\n","itemtype":"method","name":"keyPressed","example":["\n<div>\n<code>\nvar value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n}\nfunction keyPressed() {\n if (value === 0) {\n value = 255;\n } else {\n value = 0;\n }\n}\n</code>\n</div>\n<div>\n<code>\nvar value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n}\nfunction keyPressed() {\n if (keyCode === LEFT_ARROW) {\n value = 255;\n } else if (keyCode === RIGHT_ARROW) {\n value = 0;\n }\n}\n</code>\n</div>\n<div class=\"norender\">\n<code>\nfunction keyPressed(){\n // Do something\n return false; // prevent any default behaviour\n}\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Keyboard"},{"file":"src/events/keyboard.js","line":176,"description":"<p>The keyReleased() function is called once every time a key is released.\nSee key and keyCode for more information.<br><br>\nBrowsers may have different default\nbehaviors attached to various key events. To prevent any default\nbehavior for this event, add &quot;return false&quot; to the end of the method.</p>\n","itemtype":"method","name":"keyReleased","example":["\n<div>\n<code>\nvar value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n}\nfunction keyReleased() {\n if (value === 0) {\n value = 255;\n } else {\n value = 0;\n }\n return false; // prevent any default behavior\n}\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Keyboard"},{"file":"src/events/keyboard.js","line":224,"description":"<p>The keyTyped() function is called once every time a key is pressed, but\naction keys such as Ctrl, Shift, and Alt are ignored. The most recent\nkey pressed will be stored in the key variable.\n<br><br>\nBecause of how operating systems handle key repeats, holding down a key\nwill cause multiple calls to keyTyped() (and keyReleased() as well). The\nrate of repeat is set by the operating system and how each computer is\nconfigured.<br><br>\nBrowsers may have different default behaviors attached to various key\nevents. To prevent any default behavior for this event, add &quot;return false&quot;\nto the end of the method.</p>\n","itemtype":"method","name":"keyTyped","example":["\n<div>\n<code>\nvar value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n}\nfunction keyTyped() {\n if (key === 'a') {\n value = 255;\n } else if (key === 'b') {\n value = 0;\n }\n // uncomment to prevent any default behavior\n // return false;\n}\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Keyboard"},{"file":"src/events/keyboard.js","line":273,"description":"<p>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.</p>\n","class":"p5","module":"Events","submodule":"Keyboard"},{"file":"src/events/keyboard.js","line":283,"description":"<p>The keyIsDown() function checks if the key is currently down, i.e. pressed.\nIt can be used if you have an object that moves, and you want several keys\nto be able to affect its behaviour simultaneously, such as moving a\nsprite diagonally. You can put in any number representing the keyCode of\nthe key, or use any of the variable keyCode names listed\n<a href=\"http://p5js.org/reference/#p5/keyCode\">here</a>.</p>\n","itemtype":"method","name":"keyIsDown","params":[{"name":"code","description":"<p>The key to check for.</p>\n","type":"Number"}],"return":{"description":"whether key is down or not","type":"Boolean"},"example":["\n<div><code>\nvar x = 100;\nvar y = 100;\n\nfunction setup() {\n createCanvas(512, 512);\n}\n\nfunction draw() {\n if (keyIsDown(LEFT_ARROW))\n x-=5;\n\n if (keyIsDown(RIGHT_ARROW))\n x+=5;\n\n if (keyIsDown(UP_ARROW))\n y-=5;\n\n if (keyIsDown(DOWN_ARROW))\n y+=5;\n\n clear();\n fill(255, 0, 0);\n ellipse(x, y, 50, 50);\n}\n</code></div>"],"class":"p5","module":"Events","submodule":"Keyboard"},{"file":"src/events/mouse.js","line":23,"description":"<p>The system variable mouseX always contains the current horizontal\nposition of the mouse, relative to (0, 0) of the canvas.</p>\n","itemtype":"property","name":"mouseX","example":["\n<div>\n<code>\n// Move the mouse across the canvas\nfunction draw() {\n background(244, 248, 252);\n line(mouseX, 0, mouseX, 100);\n}\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Mouse"},{"file":"src/events/mouse.js","line":42,"description":"<p>The system variable mouseY always contains the current vertical position\nof the mouse, relative to (0, 0) of the canvas.</p>\n","itemtype":"property","name":"mouseY","example":["\n<div>\n<code>\n// Move the mouse across the canvas\nfunction draw() {\n background(244, 248, 252);\n line(0, mouseY, 100, mouseY);\n}\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Mouse"},{"file":"src/events/mouse.js","line":61,"description":"<p>The system variable pmouseX always contains the horizontal position of\nthe mouse in the frame previous to the current frame, relative to (0, 0)\nof the canvas.</p>\n","itemtype":"property","name":"pmouseX","example":["\n<div>\n<code>\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 println(pmouseX + \" -> \" + mouseX);\n}\n\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Mouse"},{"file":"src/events/mouse.js","line":88,"description":"<p>The system variable pmouseY always contains the vertical position of the\nmouse in the frame previous to the current frame, relative to (0, 0) of\nthe canvas.</p>\n","itemtype":"property","name":"pmouseY","example":["\n<div>\n<code>\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 println(pmouseY + \" -> \" + mouseY);\n}\n\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Mouse"},{"file":"src/events/mouse.js","line":113,"description":"<p>The system variable winMouseX always contains the current horizontal\nposition of the mouse, relative to (0, 0) of the window.</p>\n","itemtype":"property","name":"winMouseX","example":["\n<div>\n<code>\nvar myCanvas;\n\nfunction setup() {\n //use a variable to store a pointer to the canvas\n myCanvas = createCanvas(100, 100);\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}\n\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Mouse"},{"file":"src/events/mouse.js","line":146,"description":"<p>The system variable winMouseY always contains the current vertical\nposition of the mouse, relative to (0, 0) of the window.</p>\n","itemtype":"property","name":"winMouseY","example":["\n<div>\n<code>\nvar myCanvas;\n\nfunction setup() {\n //use a variable to store a pointer to the canvas\n myCanvas = createCanvas(100, 100);\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}\n\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Mouse"},{"file":"src/events/mouse.js","line":179,"description":"<p>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.</p>\n","itemtype":"property","name":"pwinMouseX","example":["\n<div>\n<code>\n\nvar 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 var 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}\n\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Mouse"},{"file":"src/events/mouse.js","line":216,"description":"<p>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.</p>\n","itemtype":"property","name":"pwinMouseY","example":["\n<div>\n<code>\n\nvar 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 var 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}\n\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Mouse"},{"file":"src/events/mouse.js","line":254,"description":"<p>Processing 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.</p>\n","itemtype":"property","name":"mouseButton","example":["\n<div>\n<code>\nfunction draw() {\n background(237, 34, 93);\n fill(0);\n\n if (mouseIsPressed) {\n if (mouseButton == LEFT)\n ellipse(50, 50, 50, 50);\n if (mouseButton == RIGHT)\n rect(25, 25, 50, 50);\n if (mouseButton == CENTER)\n triangle(23, 75, 50, 20, 78, 75);\n }\n\n println(mouseButton);\n}\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Mouse"},{"file":"src/events/mouse.js","line":285,"description":"<p>The boolean system variable mouseIsPressed is true if the mouse is pressed\nand false if not.</p>\n","itemtype":"property","name":"mouseIsPressed","example":["\n<div>\n<code>\nfunction draw() {\n background(237, 34, 93);\n fill(0);\n\n if (mouseIsPressed)\n ellipse(50, 50, 50, 50);\n else\n rect(25, 25, 50, 50);\n\n println(mouseIsPressed);\n}\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Mouse"},{"file":"src/events/mouse.js","line":360,"description":"<p>The mouseMoved() function is called every time the mouse moves and a mouse\nbutton is not pressed.<br><br>\nBrowsers may have different default\nbehaviors attached to various mouse events. To prevent any default\nbehavior for this event, add &quot;return false&quot; to the end of the method.</p>\n","itemtype":"method","name":"mouseMoved","example":["\n<div>\n<code>\n// Move the mouse across the page\n// to change its value\n\nvar value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n}\nfunction mouseMoved() {\n value = value + 5;\n if (value > 255) {\n value = 0;\n }\n}\n</code>\n</div>\n\n<div class=\"norender\">\n<code>\nfunction mouseMoved() {\n ellipse(mouseX, mouseY, 5, 5);\n // prevent default\n return false;\n}\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Mouse"},{"file":"src/events/mouse.js","line":399,"description":"<p>The mouseDragged() function is called once every time the mouse moves and\na mouse button is pressed. If no mouseDragged() function is defined, the\ntouchMoved() function will be called instead if it is defined.<br><br>\nBrowsers may have different default\nbehaviors attached to various mouse events. To prevent any default\nbehavior for this event, add &quot;return false&quot; to the end of the method.</p>\n","itemtype":"method","name":"mouseDragged","example":["\n<div>\n<code>\n// Drag the mouse across the page\n// to change its value\n\nvar value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n}\nfunction mouseDragged() {\n value = value + 5;\n if (value > 255) {\n value = 0;\n }\n}\n</code>\n</div>\n\n<div class=\"norender\">\n<code>\nfunction mouseDragged() {\n ellipse(mouseX, mouseY, 5, 5);\n // prevent default\n return false;\n}\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Mouse"},{"file":"src/events/mouse.js","line":466,"description":"<p>The mousePressed() function is called once after every time a mouse button\nis pressed. The mouseButton variable (see the related reference entry)\ncan be used to determine which button has been pressed. If no\nmousePressed() function is defined, the touchStarted() function will be\ncalled instead if it is defined.<br><br>\nBrowsers may have different default\nbehaviors attached to various mouse events. To prevent any default\nbehavior for this event, add &quot;return false&quot; to the end of the method.</p>\n","itemtype":"method","name":"mousePressed","example":["\n<div>\n<code>\n// Click within the image to change\n// the value of the rectangle\n\nvar value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n}\nfunction mousePressed() {\n if (value == 0) {\n value = 255;\n } else {\n value = 0;\n }\n}\n</code>\n</div>\n\n<div class=\"norender\">\n<code>\nfunction mousePressed() {\n ellipse(mouseX, mouseY, 5, 5);\n // prevent default\n return false;\n}\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Mouse"},{"file":"src/events/mouse.js","line":529,"description":"<p>The mouseReleased() function is called every time a mouse button is\nreleased. If no mouseReleased() function is defined, the touchEnded()\nfunction will be called instead if it is defined.<br><br>\nBrowsers may have different default\nbehaviors attached to various mouse events. To prevent any default\nbehavior for this event, add &quot;return false&quot; to the end of the method.</p>\n","itemtype":"method","name":"mouseReleased","example":["\n<div>\n<code>\n// Click within the image to change\n// the value of the rectangle\n// after the mouse has been clicked\n\nvar value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n}\nfunction mouseReleased() {\n if (value == 0) {\n value = 255;\n } else {\n value = 0;\n }\n}\n</code>\n</div>\n\n<div class=\"norender\">\n<code>\nfunction mouseReleased() {\n ellipse(mouseX, mouseY, 5, 5);\n // prevent default\n return false;\n}\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Mouse"},{"file":"src/events/mouse.js","line":592,"description":"<p>The mouseClicked() function is called once after a mouse button has been\npressed and then released.<br><br>\nBrowsers may have different default\nbehaviors attached to various mouse events. To prevent any default\nbehavior for this event, add &quot;return false&quot; to the end of the method.</p>\n","itemtype":"method","name":"mouseClicked","example":["\n<div>\n<code>\n// Click within the image to change\n// the value of the rectangle\n// after the mouse has been clicked\n\nvar value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n}\nfunction mouseClicked() {\n if (value == 0) {\n value = 255;\n } else {\n value = 0;\n }\n}\n</code>\n</div>\n\n<div class=\"norender\">\n<code>\nfunction mouseClicked() {\n ellipse(mouseX, mouseY, 5, 5);\n // prevent default\n return false;\n}\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Mouse"},{"file":"src/events/mouse.js","line":642,"description":"<p>The function mouseWheel() is executed every time a vertical mouse wheel\nevent is detected either triggered by an actual mouse wheel or by a\ntouchpad.<br><br>\nThe event.delta property returns the amount the mouse wheel\nhave scrolled. The values can be positive or negative depending on the\nscroll direction (on OS X with &quot;natural&quot; scrolling enabled, the signs\nare inverted).<br><br>\nBrowsers may have different default behaviors attached to various\nmouse events. To prevent any default behavior for this event, add\n&quot;return false&quot; to the end of the method.<br><br>\nDue to the current support of the &quot;wheel&quot; event on Safari, the function\nmay only work as expected if &quot;return false&quot; is included while using Safari.</p>\n","itemtype":"method","name":"mouseWheel","example":["\n<div>\n<code>\nvar pos = 25;\n\nfunction draw() {\n background(237, 34, 93);\n fill(0);\n rect(25, pos, 50, 50);\n}\n\nfunction mouseWheel(event) {\n println(event.delta);\n //move the square according to the vertical scroll amount\n pos += event.delta;\n //uncomment to block page scrolling\n //return false;\n}\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Mouse"},{"file":"src/events/touch.js","line":20,"description":"<p>The system variable touchX always contains the horizontal position of\none finger, relative to (0, 0) of the canvas. This is best used for\nsingle touch interactions. For multi-touch interactions, use the\ntouches[] array.</p>\n","itemtype":"method","name":"touchX","example":["\n<div>\n<code>\n// Touch and move the finger in horizontally across the canvas\nfunction setup() {\n createCanvas(100, 100);\n}\n\nfunction draw() {\n background(51);\n stroke(255, 204, 0);\n strokeWeight(4);\n rect(touchX, 50, 10, 10);\n}\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Touch"},{"file":"src/events/touch.js","line":47,"description":"<p>The system variable touchY always contains the vertical position of\none finger, relative to (0, 0) of the canvas. This is best used for\nsingle touch interactions. For multi-touch interactions, use the\ntouches[] array.</p>\n","itemtype":"method","name":"touchY","example":["\n<div>\n<code>\n// Touch and move the finger vertically across the canvas\nfunction setup() {\n createCanvas(100, 100);\n}\n\nfunction draw() {\n background(51);\n stroke(255, 204, 0);\n strokeWeight(4);\n rect(50, touchY, 10, 10);\n}\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Touch"},{"file":"src/events/touch.js","line":74,"description":"<p>The system variable ptouchX always contains the horizontal position of\none finger, relative to (0, 0) of the canvas, in the frame previous to the\ncurrent frame.</p>\n","itemtype":"property","name":"ptouchX","class":"p5","module":"Events","submodule":"Touch"},{"file":"src/events/touch.js","line":83,"description":"<p>The system variable ptouchY always contains the vertical position of\none finger, relative to (0, 0) of the canvas, in the frame previous to the\ncurrent frame.</p>\n","itemtype":"property","name":"ptouchY","class":"p5","module":"Events","submodule":"Touch"},{"file":"src/events/touch.js","line":92,"description":"<p>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.</p>\n","itemtype":"property","name":"touches[]","class":"p5","module":"Events","submodule":"Touch"},{"file":"src/events/touch.js","line":102,"description":"<p>The boolean system variable touchIsDown is true if the screen is\ntouched and false if not.</p>\n","itemtype":"property","name":"touchIsDown","class":"p5","module":"Events","submodule":"Touch"},{"file":"src/events/touch.js","line":156,"description":"<p>The touchStarted() function is called once after every time a touch is\nregistered. If no touchStarted() function is defined, the mousePressed()\nfunction will be called instead if it is defined.<br><br>\nBrowsers may have different default behaviors attached to various touch\nevents. To prevent any default behavior for this event, add &quot;return false&quot;\nto the end of the method.</p>\n","itemtype":"method","name":"touchStarted","example":["\n<div>\n<code>\n// Touch within the image to change\n// the value of the rectangle\n\nvar value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n}\nfunction touchStarted() {\n if (value == 0) {\n value = 255;\n } else {\n value = 0;\n }\n}\n</code>\n</div>\n\n<div class=\"norender\">\n<code>\nfunction touchStarted() {\n ellipse(touchX, touchY, 5, 5);\n // prevent default\n return false;\n}\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Touch"},{"file":"src/events/touch.js","line":216,"description":"<p>The touchMoved() function is called every time a touch move is registered.\nIf no touchMoved() function is defined, the mouseDragged() function will\nbe called instead if it is defined.<br><br>\nBrowsers may have different default behaviors attached to various touch\nevents. To prevent any default behavior for this event, add &quot;return false&quot;\nto the end of the method.</p>\n","itemtype":"method","name":"touchMoved","example":["\n<div>\n<code>\n// Move your finger across the page\n// to change its value\n\nvar value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n}\nfunction touchMoved() {\n value = value + 5;\n if (value > 255) {\n value = 0;\n }\n}\n</code>\n</div>\n\n<div class=\"norender\">\n<code>\nfunction touchMoved() {\n ellipse(touchX, touchY, 5, 5);\n // prevent default\n return false;\n}\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Touch"},{"file":"src/events/touch.js","line":273,"description":"<p>The touchEnded() function is called every time a touch ends. If no\ntouchEnded() function is defined, the mouseReleased() function will be\ncalled instead if it is defined.<br><br>\nBrowsers may have different default behaviors attached to various touch\nevents. To prevent any default behavior for this event, add &quot;return false&quot;\nto the end of the method.</p>\n","itemtype":"method","name":"touchEnded","example":["\n<div>\n<code>\n// Release touch within the image to\n// change the value of the rectangle\n\nvar value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n}\nfunction touchEnded() {\n if (value == 0) {\n value = 255;\n } else {\n value = 0;\n }\n}\n</code>\n</div>\n\n<div class=\"norender\">\n<code>\nfunction touchEnded() {\n ellipse(touchX, touchY, 5, 5);\n // prevent default\n return false;\n}\n</code>\n</div>"],"class":"p5","module":"Events","submodule":"Touch"},{"file":"src/image/filters.js","line":3,"description":"<p>This module defines the filters for use with image buffers.</p>\n<p>This module is basically a collection of functions stored in an object\nas opposed to modules. The functions are destructive, modifying\nthe passed in canvas rather than creating a copy.</p>\n<p>Generally speaking users of this module will use the Filters.apply method\non a canvas to create an effect.</p>\n<p>A number of functions are borrowed/adapted from\n<a href=\"http://www.html5rocks.com/en/tutorials/canvas/imagefilters/\">http://www.html5rocks.com/en/tutorials/canvas/imagefilters/</a>\nor the java processing implementation.</p>\n","class":"p5","module":"Events"},{"file":"src/image/filters.js","line":28,"description":"<p>Returns the pixel buffer for a canvas</p>\n","access":"private","tagname":"","params":[{"name":"canvas","description":"<p>the canvas to get pixels from</p>\n","type":"Canvas|ImageData"}],"return":{"description":"a one-dimensional array containing\n the data in thc RGBA order, with integer\n values between 0 and 255","type":"Uint8ClampedArray"},"class":"p5","module":"Events"},{"file":"src/image/filters.js","line":51,"description":"<p>Returns a 32 bit number containing ARGB data at ith pixel in the\n1D array containing pixels data.</p>\n","access":"private","tagname":"","params":[{"name":"data","description":"<p>array returned by _toPixels()</p>\n","type":"Uint8ClampedArray"},{"name":"i","description":"<p>index of a 1D Image Array</p>\n","type":"Integer"}],"return":{"description":"32 bit integer value representing\n ARGB value.","type":"Integer"},"class":"p5","module":"Events"},{"file":"src/image/filters.js","line":70,"description":"<p>Modifies pixels RGBA values to values contained in the data object.</p>\n","access":"private","tagname":"","params":[{"name":"pixels","description":"<p>array returned by _toPixels()</p>\n","type":"Uint8ClampedArray"},{"name":"data","description":"<p>source 1D array where each value\n represents ARGB values</p>\n","type":"Int32Array"}],"class":"p5","module":"Events"},{"file":"src/image/filters.js","line":90,"description":"<p>Returns the ImageData object for a canvas\n<a href=\"https://developer.mozilla.org/en-US/docs/Web/API/ImageData\">https://developer.mozilla.org/en-US/docs/Web/API/ImageData</a></p>\n","access":"private","tagname":"","params":[{"name":"canvas","description":"<p>canvas to get image data from</p>\n","type":"Canvas|ImageData"}],"return":{"description":"Holder of pixel data (and width and\n height) for a canvas","type":"ImageData"},"class":"p5","module":"Events"},{"file":"src/image/filters.js","line":113,"description":"<p>Returns a blank ImageData object.</p>\n","access":"private","tagname":"","params":[{"name":"width","description":"","type":"Integer"},{"name":"height","description":"","type":"Integer"}],"return":{"description":"","type":"ImageData"},"class":"p5","module":"Events"},{"file":"src/image/filters.js","line":129,"description":"<p>Applys a filter function to a canvas.</p>\n<p>The difference between this and the actual filter functions defined below\nis that the filter functions generally modify the pixel buffer but do\nnot actually put that data back to the canvas (where it would actually\nupdate what is visible). By contrast this method does make the changes\nactually visible in the canvas.</p>\n<p>The apply method is the method that callers of this module would generally\nuse. It has been separated from the actual filters to support an advanced\nuse case of creating a filter chain that executes without actually updating\nthe canvas in between everystep.</p>\n","params":[{"name":"func","description":"<p>[description]</p>\n","type":"[type]"},{"name":"canvas","description":"<p>[description]</p>\n","type":"[type]"},{"name":"level","description":"<p>[description]</p>\n","type":"[type]"}],"return":{"description":"[description]","type":"[type]"},"class":"p5","module":"Events"},{"file":"src/image/filters.js","line":168,"description":"<p>Converts the image to black and white pixels depending if they are above or\nbelow the threshold defined by the level parameter. The parameter must be\nbetween 0.0 (black) and 1.0 (white). If no level is specified, 0.5 is used.</p>\n<p>Borrowed from <a href=\"http://www.html5rocks.com/en/tutorials/canvas/imagefilters/\">http://www.html5rocks.com/en/tutorials/canvas/imagefilters/</a></p>\n","params":[{"name":"canvas","description":"","type":"Canvas"},{"name":"level","description":"","type":"Float"}],"class":"p5","module":"Events"},{"file":"src/image/filters.js","line":203,"description":"<p>Converts any colors in the image to grayscale equivalents.\nNo parameter is used.</p>\n<p>Borrowed from <a href=\"http://www.html5rocks.com/en/tutorials/canvas/imagefilters/\">http://www.html5rocks.com/en/tutorials/canvas/imagefilters/</a></p>\n","params":[{"name":"canvas","description":"","type":"Canvas"}],"class":"p5","module":"Events"},{"file":"src/image/filters.js","line":225,"description":"<p>Sets the alpha channel to entirely opaque. No parameter is used.</p>\n","params":[{"name":"canvas","description":"","type":"Canvas"}],"class":"p5","module":"Events"},{"file":"src/image/filters.js","line":240,"description":"<p>Sets each pixel to its inverse value. No parameter is used.</p>\n","params":[{"name":"UNKNOWN","description":"","type":"Invert"}],"class":"p5","module":"Events"},{"file":"src/image/filters.js","line":256,"description":"<p>Limits each channel of the image to the number of colors specified as\nthe parameter. The parameter can be set to values between 2 and 255, but\nresults are most noticeable in the lower ranges.</p>\n<p>Adapted from java based processing implementation</p>\n","params":[{"name":"canvas","description":"","type":"Canvas"},{"name":"level","description":"","type":"Integer"}],"class":"p5","module":"Events"},{"file":"src/image/filters.js","line":287,"description":"<p>reduces the bright areas in an image</p>\n","params":[{"name":"canvas","description":"","type":"Canvas"}],"class":"p5","module":"Events"},{"file":"src/image/filters.js","line":368,"description":"<p>increases the bright areas in an image</p>\n","params":[{"name":"canvas","description":"","type":"Canvas"}],"class":"p5","module":"Events"},{"file":"src/image/image.js","line":8,"description":"<p>This module defines the p5 methods for the p5.Image class\nfor drawing images to the main display canvas.</p>\n","class":"p5","module":"Image","submodule":"Image"},{"file":"src/image/image.js","line":24,"description":"<p>Creates a new p5.Image (the datatype for storing images). This provides a\nfresh buffer of pixels to play with. Set the size of the buffer with the\nwidth and height parameters.\n<br><br>\n.pixels gives access to an array containing the values for all the pixels\nin the display window.\nThese values are numbers. This array is the size (including an appropriate\nfactor for the pixelDensity) of the display window x4,\nrepresenting the R, G, B, A values in order for each pixel, moving from\nleft to right across each row, then down each column. See .pixels for\nmore info. It may also be simpler to use set() or get().\n<br><br>\nBefore accessing the pixels of an image, the data must loaded with the\nloadPixels() function. After the array data has been modified, the\nupdatePixels() function must be run to update the changes.</p>\n","itemtype":"method","name":"createImage","params":[{"name":"width","description":"<p>width in pixels</p>\n","type":"Integer"},{"name":"height","description":"<p>height in pixels</p>\n","type":"Integer"}],"return":{"description":"the p5.Image object","type":"p5.Image"},"example":["\n<div>\n<code>\nimg = createImage(66, 66);\nimg.loadPixels();\nfor (i = 0; i < img.width; i++) {\n for (j = 0; j < img.height; j++) {\n img.set(i, j, color(0, 90, 102));\n }\n}\nimg.updatePixels();\nimage(img, 17, 17);\n</code>\n</div>\n\n<div>\n<code>\nimg = createImage(66, 66);\nimg.loadPixels();\nfor (i = 0; i < img.width; i++) {\n for (j = 0; j < img.height; j++) {\n img.set(i, j, color(0, 90, 102, i % img.width * 2));\n }\n}\nimg.updatePixels();\nimage(img, 17, 17);\nimage(img, 34, 34);\n</code>\n</div>\n\n<div>\n<code>\nvar pink = color(255, 102, 204);\nimg = createImage(66, 66);\nimg.loadPixels();\nvar d = pixelDensity;\nvar halfImage = 4 * (width * d) * (height/2 * d);\nfor (var i = 0; i < halfImage; i+=4) {\n img.pixels[i] = red(pink);\n img.pixels[i+1] = green(pink);\n img.pixels[i+2] = blue(pink);\n img.pixels[i+3] = alpha(pink);\n}\nimg.updatePixels();\nimage(img, 17, 17);\n</code>\n</div>"],"class":"p5","module":"Image","submodule":"Image"},{"file":"src/image/image.js","line":97,"description":"<p>Save the current canvas as an image. In Safari, this will open the\nimage in the window and the user must provide their own\nfilename on save-as. Other browsers will either save the\nfile immediately, or prompt the user with a dialogue window.</p>\n","itemtype":"method","name":"saveCanvas","params":[{"name":"canvas","description":"<p>a variable representing a\n specific html5 canvas (optional)</p>\n","type":"[selectedCanvas]"},{"name":"filename","description":"","type":"[String]"},{"name":"extension","description":"<p>&#39;jpg&#39; or &#39;png&#39;</p>\n","type":"[String]"}],"example":["\n<div class='norender'><code>\nfunction setup() {\n var c = createCanvas(100, 100);\n background(255, 0, 0);\n saveCanvas(c, 'myCanvas', 'jpg');\n}\n</code></div>\n<div class='norender'><code>\n// note that this example has the same result as above\n// if no canvas is specified, defaults to main canvas\nfunction setup() {\n createCanvas(100, 100);\n background(255, 0, 0);\n saveCanvas('myCanvas', 'jpg');\n}\n</code></div>\n<div class='norender'><code>\n// all of the following are valid\nsaveCanvas(c, 'myCanvas', 'jpg');\nsaveCanvas(c, 'myCanvas');\nsaveCanvas(c);\nsaveCanvas('myCanvas', 'png');\nsaveCanvas('myCanvas');\nsaveCanvas();\n</code></div>"],"class":"p5","module":"Image","submodule":"Image"},{"file":"src/image/image.js","line":215,"description":"<p>Capture a sequence of frames that can be used to create a movie.\nAccepts a callback. For example, you may wish to send the frames\nto a server where they can be stored or converted into a movie.\nIf no callback is provided, the browser will pop up save dialogues in an\nattempt to download all of the images that have just been created. With the\ncallback provided the image data isn&#39;t saved by default but instead passed\nas an argument to the callback function as an array of objects, with the\nsize of array equal to the total number of frames.</p>\n","itemtype":"method","name":"saveFrames","params":[{"name":"filename","description":"","type":"String"},{"name":"extension","description":"<p>&#39;jpg&#39; or &#39;png&#39;</p>\n","type":"String"},{"name":"duration","description":"<p>Duration in seconds to save the frames for.</p>\n","type":"Number"},{"name":"framerate","description":"<p>Framerate to save the frames in.</p>\n","type":"Number"},{"name":"callback","description":"<p>A callback function that will be executed\n to handle the image data. This function\n should accept an array as argument. The\n array will contain the specified number of\n frames of objects. Each object has three\n properties: imageData - an\n image/octet-stream, filename and extension.</p>\n","type":"Function","optional":true}],"example":["\n<div><code>\nfunction draw() {\n background(mouseX);\n}\n\nfunction mousePressed() {\n saveFrames(\"out\", \"png\", 1, 25, function(data){\n println(data);\n });\n}\n</code></div>"],"class":"p5","module":"Image","submodule":"Image"},{"file":"src/image/loading_displaying.js","line":17,"description":"<p>Loads an image from a path and creates a p5.Image from it.\n<br><br>\nThe image may not be immediately available for rendering\nIf you want to ensure that the image is ready before doing\nanything with it, place the loadImage() call in preload().\nYou may also supply a callback function to handle the image when it&#39;s ready.\n<br><br>\nThe path to the image should be relative to the HTML file\nthat links in your sketch. Loading an from a URL or other\nremote location may be blocked due to your browser&#39;s built-in\nsecurity.</p>\n","itemtype":"method","name":"loadImage","params":[{"name":"path","description":"<p>Path of the image to be loaded</p>\n","type":"String"},{"name":"successCallback","description":"<p>Function to be called once\n the image is loaded. Will be passed the\n p5.Image.</p>\n","type":"Function(p5.Image)","optional":true},{"name":"failureCallback","description":"<p>called with event error if\n the image fails to load.</p>\n","type":"Function(Event)","optional":true}],"return":{"description":"the p5.Image object","type":"p5.Image"},"example":["\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/laDefense.jpg\");\n}\nfunction setup() {\n image(img, 0, 0);\n}\n</code>\n</div>\n<div>\n<code>\nfunction setup() {\n // here we use a callback to display the image after loading\n loadImage(\"assets/laDefense.jpg\", function(img) {\n image(img, 0, 0);\n });\n}\n</code>\n</div>"],"class":"p5","module":"Image","submodule":"Loading & Displaying"},{"file":"src/image/loading_displaying.js","line":104,"description":"<p>Validates clipping params. Per drawImage spec sWidth and sHight cannot be\nnegative or greater than image intrinsic width and height</p>\n","access":"private","tagname":"","params":[{"name":"sVal","description":"","type":"Number"},{"name":"iVal","description":"","type":"Number"}],"return":{"description":"","type":"Number"},"class":"p5","module":"Image","submodule":"Loading & Displaying"},{"file":"src/image/loading_displaying.js","line":122,"description":"<p>Draw an image to the main canvas of the p5js sketch</p>\n","itemtype":"method","name":"image","params":[{"name":"img","description":"<p>the image to display</p>\n","type":"p5.Image"},{"name":"sx","description":"<p>The X coordinate of the top left corner of the\n sub-rectangle of the source image to draw into\n the destination canvas.</p>\n","type":"Number","optional":true,"optdefault":"0"},{"name":"sy","description":"<p>The Y coordinate of the top left corner of the\n sub-rectangle of the source image to draw into\n the destination canvas.</p>\n","type":"Number","optional":true,"optdefault":"0"},{"name":"sWidth","description":"<p>The width of the sub-rectangle of the\n source image to draw into the destination\n canvas.</p>\n","type":"Number","optional":true,"optdefault":"img.width"},{"name":"sHeight","description":"<p>The height of the sub-rectangle of the\n source image to draw into the\n destination context.</p>\n","type":"Number","optional":true,"optdefault":"img.height"},{"name":"dx","description":"<p>The X coordinate in the destination canvas at\n which to place the top-left corner of the\n source image.</p>\n","type":"Number","optional":true,"optdefault":"0"},{"name":"dy","description":"<p>The Y coordinate in the destination canvas at\n which to place the top-left corner of the\n source image.</p>\n","type":"Number","optional":true,"optdefault":"0"},{"name":"dWidth","description":"<p>The width to draw the image in the destination\n canvas. This allows scaling of the drawn image.</p>\n","type":"Number","optional":true},{"name":"dHeight","description":"<p>The height to draw the image in the destination\n canvas. This allows scaling of the drawn image.</p>\n","type":"Number","optional":true}],"example":["\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/laDefense.jpg\");\n}\nfunction setup() {\n image(img, 0, 0);\n image(img, 0, 0, 100, 100);\n image(img, 0, 0, 100, 100, 0, 0, 100, 100);\n}\n</code>\n</div>\n<div>\n<code>\nfunction setup() {\n // here we use a callback to display the image after loading\n loadImage(\"assets/laDefense.jpg\", function(img) {\n image(img, 0, 0);\n });\n}\n</code>\n</div>"],"class":"p5","module":"Image","submodule":"Loading & Displaying"},{"file":"src/image/loading_displaying.js","line":231,"description":"<p>Sets the fill value for displaying images. Images can be tinted to\nspecified colors or made transparent by including an alpha value.\n<br><br>\nTo apply transparency to an image without affecting its color, use\nwhite as the tint color and specify an alpha value. For instance,\ntint(255, 128) will make an image 50% transparent (assuming the default\nalpha range of 0-255, which can be changed with colorMode()).\n<br><br>\nThe value for the gray parameter must be less than or equal to the current\nmaximum value as specified by colorMode(). The default maximum value is\n255.</p>\n","itemtype":"method","name":"tint","params":[{"name":"v1","description":"<p>gray value, red or hue value (depending on the\n current color mode), or color Array</p>\n","type":"Number|Array"},{"name":"v2","description":"<p>green or saturation value (depending on the\n current color mode)</p>\n","type":"Number|Array","optional":true},{"name":"v3","description":"<p>blue or brightness value (depending on the\n current color mode)</p>\n","type":"Number|Array","optional":true},{"name":"a","description":"<p>opacity of the background</p>\n","type":"Number|Array","optional":true}],"example":["\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/laDefense.jpg\");\n}\nfunction setup() {\n image(img, 0, 0);\n tint(0, 153, 204); // Tint blue\n image(img, 50, 0);\n}\n</code>\n</div>\n\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/laDefense.jpg\");\n}\nfunction setup() {\n image(img, 0, 0);\n tint(0, 153, 204, 126); // Tint blue and set transparency\n image(img, 50, 0);\n}\n</code>\n</div>\n\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/laDefense.jpg\");\n}\nfunction setup() {\n image(img, 0, 0);\n tint(255, 126); // Apply transparency without changing color\n image(img, 50, 0);\n}\n</code>\n</div>"],"class":"p5","module":"Image","submodule":"Loading & Displaying"},{"file":"src/image/loading_displaying.js","line":300,"description":"<p>Removes the current fill value for displaying images and reverts to\ndisplaying images with their original hues.</p>\n","itemtype":"method","name":"noTint","example":["\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/bricks.jpg\");\n}\nfunction setup() {\n tint(0, 153, 204); // Tint blue\n image(img, 0, 0);\n noTint(); // Disable tint\n image(img, 50, 0);\n}\n</code>\n</div>"],"class":"p5","module":"Image","submodule":"Loading & Displaying"},{"file":"src/image/loading_displaying.js","line":325,"description":"<p>Apply the current tint color to the input image, return the resulting\ncanvas.</p>\n","params":[{"name":"The","description":"<p>image to be tinted</p>\n","type":"p5.Image"}],"return":{"description":"The resulting tinted canvas","type":"Canvas"},"class":"p5","module":"Image","submodule":"Loading & Displaying"},{"file":"src/image/loading_displaying.js","line":361,"description":"<p>Set image mode. Modifies the location from which images are drawn by\nchanging the way in which parameters given to image() are interpreted.\nThe default mode is imageMode(CORNER), which interprets the second and\nthird parameters of image() as the upper-left corner of the image. If\ntwo additional parameters are specified, they are used to set the image&#39;s\nwidth and height.\n<br><br>\nimageMode(CORNERS) interprets the second and third parameters of image()\nas the location of one corner, and the fourth and fifth parameters as the\nopposite corner.\n<br><br>\nimageMode(CENTER) interprets the second and third parameters of image()\nas the image&#39;s center point. If two additional parameters are specified,\nthey are used to set the image&#39;s width and height.</p>\n","itemtype":"method","name":"imageMode","params":[{"name":"mode","description":"<p>either CORNER, CORNERS, or CENTER</p>\n","type":"Constant"}],"example":["\n\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/bricks.jpg\");\n}\nfunction setup() {\n imageMode(CORNER);\n image(img, 10, 10, 50, 50);\n}\n</code>\n</div>\n\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/bricks.jpg\");\n}\nfunction setup() {\n imageMode(CORNERS);\n image(img, 10, 10, 90, 40);\n}\n</code>\n</div>\n\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/bricks.jpg\");\n}\nfunction setup() {\n imageMode(CENTER);\n image(img, 50, 50, 80, 80);\n}\n</code>\n</div>"],"class":"p5","module":"Image","submodule":"Loading & Displaying"},{"file":"src/image/p5.Image.js","line":9,"description":"<p>This module defines the p5.Image class and P5 methods for\ndrawing images to the main display canvas.</p>\n","class":"p5.Image","module":"Image","submodule":"Image"},{"file":"src/image/p5.Image.js","line":46,"description":"<p>Image width.</p>\n","itemtype":"property","name":"width","example":["\n<div><code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/rockies.jpg\");\n}\n\nfunction setup() {\n createCanvas(100, 100);\n image(img, 0, 0);\n for (var i=0; i < img.width; i++) {\n var c = img.get(i, img.height/2);\n stroke(c);\n line(i, height/2, i, height);\n }\n}\n</code></div>"],"class":"p5.Image","module":"Image","submodule":"Image"},{"file":"src/image/p5.Image.js","line":68,"description":"<p>Image height.</p>\n","itemtype":"property","name":"height","example":["\n<div><code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/rockies.jpg\");\n}\n\nfunction setup() {\n createCanvas(100, 100);\n image(img, 0, 0);\n for (var i=0; i < img.height; i++) {\n var c = img.get(img.width/2, i);\n stroke(c);\n line(0, i, width/2, i);\n }\n}\n</code></div>"],"class":"p5.Image","module":"Image","submodule":"Image"},{"file":"src/image/p5.Image.js","line":97,"description":"<p>Array containing the values for all the pixels in the display window.\nThese values are numbers. This array is the size (include an appropriate\nfactor for pixelDensity) of the display window x4,\nrepresenting the R, G, B, A values in order for each pixel, moving from\nleft to right across each row, then down each column. Retina and other\nhigh denisty displays may have more pixels[] (by a factor of\npixelDensity^2).\nFor example, if the image is 100x100 pixels, there will be 40,000. With\npixelDensity = 2, there will be 160,000. The first four values\n(indices 0-3) in the array will be the R, G, B, A values of the pixel at\n(0, 0). The second four values (indices 4-7) will contain the R, G, B, A\nvalues of the pixel at (1, 0). More generally, to set values for a pixel\nat (x, y):\n<code><pre>var d = pixelDensity;\nfor (var i = 0; i &lt; d; i++) {\n for (var j = 0; j &lt; d; j++) {\n // loop over\n idx = 4<em>((y </em> d + j) <em> width </em> d + (x * d + i));\n pixels[idx] = r;\n pixels[idx+1] = g;\n pixels[idx+2] = b;\n pixels[idx+3] = a;\n }\n}\n</pre></code>\n<br><br>\nBefore accessing this array, the data must loaded with the loadPixels()\nfunction. After the array data has been modified, the updatePixels()\nfunction must be run to update the changes.</p>\n","itemtype":"property","name":"pixels[]","example":["\n<div>\n<code>\nimg = createImage(66, 66);\nimg.loadPixels();\nfor (i = 0; i < img.width; i++) {\n for (j = 0; j < img.height; j++) {\n img.set(i, j, color(0, 90, 102));\n }\n}\nimg.updatePixels();\nimage(img, 17, 17);\n</code>\n</div>\n<div>\n<code>\nvar pink = color(255, 102, 204);\nimg = createImage(66, 66);\nimg.loadPixels();\nfor (var i = 0; i < 4*(width*height/2); i+=4) {\n img.pixels[i] = red(pink);\n img.pixels[i+1] = green(pink);\n img.pixels[i+2] = blue(pink);\n img.pixels[i+3] = alpha(pink);\n}\nimg.updatePixels();\nimage(img, 17, 17);\n</code>\n</div>"],"class":"p5.Image","module":"Image","submodule":"Image"},{"file":"src/image/p5.Image.js","line":161,"description":"<p>Helper fxn for sharing pixel methods</p>\n","class":"p5.Image","module":"Image","submodule":"Image"},{"file":"src/image/p5.Image.js","line":169,"description":"<p>Loads the pixels data for this image into the [pixels] attribute.</p>\n","itemtype":"method","name":"loadPixels","example":["\n<div><code>\nvar myImage;\nvar halfImage;\n\nfunction preload() {\n myImage = loadImage(\"assets/rockies.jpg\");\n}\n\nfunction setup() {\n myImage.loadPixels();\n halfImage = 4 * width * height/2;\n for(var i = 0; i < halfImage; i++){\n myImage.pixels[i+halfImage] = myImage.pixels[i];\n }\n myImage.updatePixels();\n}\n\nfunction draw() {\n image(myImage, 0, 0);\n}\n</code></div>"],"class":"p5.Image","module":"Image","submodule":"Image"},{"file":"src/image/p5.Image.js","line":200,"description":"<p>Updates the backing canvas for this image with the contents of\nthe [pixels] array.</p>\n","itemtype":"method","name":"updatePixels","params":[{"name":"x","description":"<p>x-offset of the target update area for the\n underlying canvas</p>\n","type":"Integer|undefined"},{"name":"y","description":"<p>y-offset of the target update area for the\n underlying canvas</p>\n","type":"Integer|undefined"},{"name":"w","description":"<p>height of the target update area for the\n underlying canvas</p>\n","type":"Integer|undefined"},{"name":"h","description":"<p>height of the target update area for the\n underlying canvas</p>\n","type":"Integer|undefined"}],"example":["\n<div><code>\nvar myImage;\nvar halfImage;\n\nfunction preload() {\n myImage = loadImage(\"assets/rockies.jpg\");\n}\n\nfunction setup() {\n myImage.loadPixels();\n halfImage = 4 * width * height/2;\n for(var i = 0; i < halfImage; i++){\n myImage.pixels[i+halfImage] = myImage.pixels[i];\n }\n myImage.updatePixels();\n}\n\nfunction draw() {\n image(myImage, 0, 0);\n}\n</code></div>"],"class":"p5.Image","module":"Image","submodule":"Image"},{"file":"src/image/p5.Image.js","line":240,"description":"<p>Get a region of pixels from an image.</p>\n<p>If no params are passed, those whole image is returned,\nif x and y are the only params passed a single pixel is extracted\nif all params are passed a rectangle region is extracted and a p5.Image\nis returned.</p>\n<p>Returns undefined if the region is outside the bounds of the image</p>\n","itemtype":"method","name":"get","params":[{"name":"x","description":"<p>x-coordinate of the pixel</p>\n","type":"Number","optional":true},{"name":"y","description":"<p>y-coordinate of the pixel</p>\n","type":"Number","optional":true},{"name":"w","description":"<p>width</p>\n","type":"Number","optional":true},{"name":"h","description":"<p>height</p>\n","type":"Number","optional":true}],"return":{"description":"color of pixel at x,y in array format\n [R, G, B, A] or p5.Image","type":"Array/Color | p5.Image"},"example":["\n<div><code>\nvar myImage;\nvar c;\n\nfunction preload() {\n myImage = loadImage(\"assets/rockies.jpg\");\n}\n\nfunction setup() {\n background(myImage);\n noStroke();\n c = myImage.get(60, 90);\n fill(c);\n rect(25, 25, 50, 50);\n}\n\n//get() returns color here\n</code></div>"],"class":"p5.Image","module":"Image","submodule":"Image"},{"file":"src/image/p5.Image.js","line":281,"description":"<p>Set the color of a single pixel or write an image into\nthis p5.Image.</p>\n<p>Note that for a large number of pixels this will\nbe slower than directly manipulating the pixels array\nand then calling updatePixels().</p>\n","itemtype":"method","name":"set","params":[{"name":"x","description":"<p>x-coordinate of the pixel</p>\n","type":"Number"},{"name":"y","description":"<p>y-coordinate of the pixel</p>\n","type":"Number"},{"name":"a","description":"<p>grayscale value | pixel array |\n a p5.Color | image to copy</p>\n","type":"Number|Array|Object"}],"example":["\n<div>\n<code>\nimg = createImage(66, 66);\nimg.loadPixels();\nfor (i = 0; i < img.width; i++) {\n for (j = 0; j < img.height; j++) {\n img.set(i, j, color(0, 90, 102, i % img.width * 2));\n }\n}\nimg.updatePixels();\nimage(img, 17, 17);\nimage(img, 34, 34);\n</code>\n</div>"],"class":"p5.Image","module":"Image","submodule":"Image"},{"file":"src/image/p5.Image.js","line":314,"description":"<p>Resize the image to a new width and height. To make the image scale\nproportionally, use 0 as the value for the wide or high parameter.\nFor instance, to make the width of an image 150 pixels, and change\nthe height using the same proportion, use resize(150, 0).</p>\n","itemtype":"method","name":"resize","params":[{"name":"width","description":"<p>the resized image width</p>\n","type":"Number"},{"name":"height","description":"<p>the resized image height</p>\n","type":"Number"}],"example":["\n<div><code>\nvar img;\n\nfunction setup() {\n img = loadImage(\"assets/rockies.jpg\");\n}\n\nfunction draw() {\n image(img, 0, 0);\n}\n\nfunction mousePressed() {\n img.resize(50, 100);\n}\n</code></div>"],"class":"p5.Image","module":"Image","submodule":"Image"},{"file":"src/image/p5.Image.js","line":387,"description":"<p>Copies a region of pixels from one image to another. If no\nsrcImage is specified this is used as the source. If the source\nand destination regions aren&#39;t the same size, it will\nautomatically resize source pixels to fit the specified\ntarget region.</p>\n","itemtype":"method","name":"copy","params":[{"name":"srcImage","description":"<p>source image</p>\n","type":"p5.Image|undefined"},{"name":"sx","description":"<p>X coordinate of the source&#39;s upper left corner</p>\n","type":"Integer"},{"name":"sy","description":"<p>Y coordinate of the source&#39;s upper left corner</p>\n","type":"Integer"},{"name":"sw","description":"<p>source image width</p>\n","type":"Integer"},{"name":"sh","description":"<p>source image height</p>\n","type":"Integer"},{"name":"dx","description":"<p>X coordinate of the destination&#39;s upper left corner</p>\n","type":"Integer"},{"name":"dy","description":"<p>Y coordinate of the destination&#39;s upper left corner</p>\n","type":"Integer"},{"name":"dw","description":"<p>destination image width</p>\n","type":"Integer"},{"name":"dh","description":"<p>destination image height</p>\n","type":"Integer"}],"example":["\n<div><code>\nvar photo;\nvar bricks;\nvar x;\nvar y;\n\nfunction preload() {\n photo = loadImage(\"assets/rockies.jpg\");\n bricks = loadImage(\"assets/bricks.jpg\");\n}\n\nfunction setup() {\n x = bricks.width/2;\n y = bricks.height/2;\n photo.copy(bricks, 0, 0, x, y, 0, 0, x, y);\n image(photo, 0, 0);\n}\n</code></div>"],"class":"p5.Image","module":"Image","submodule":"Image"},{"file":"src/image/p5.Image.js","line":428,"description":"<p>Masks part of an image from displaying by loading another\nimage and using it&#39;s blue channel as an alpha channel for\nthis image.</p>\n","itemtype":"method","name":"mask","params":[{"name":"srcImage","description":"<p>source image</p>\n","type":"p5.Image"}],"example":["\n<div><code>\nvar photo, maskImage;\nfunction preload() {\n photo = loadImage(\"assets/rockies.jpg\");\n maskImage = loadImage(\"assets/mask2.png\");\n}\n\nfunction setup() {\n createCanvas(100, 100);\n photo.mask(maskImage);\n image(photo, 0, 0);\n}\n</code></div>\n\nhttp://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/\n"],"class":"p5.Image","module":"Image","submodule":"Image"},{"file":"src/image/p5.Image.js","line":486,"description":"<p>Applies an image filter to a p5.Image</p>\n","itemtype":"method","name":"filter","params":[{"name":"operation","description":"<p>one of threshold, gray, invert, posterize and\n opaque see Filters.js for docs on each available\n filter</p>\n","type":"String"},{"name":"value","description":"","type":"Number|undefined"}],"example":["\n<div><code>\nvar photo1;\nvar photo2;\n\nfunction preload() {\n photo1 = loadImage(\"assets/rockies.jpg\");\n photo2 = loadImage(\"assets/rockies.jpg\");\n}\n\nfunction setup() {\n photo2.filter(\"gray\");\n image(photo1, 0, 0);\n image(photo2, width/2, 0);\n}\n</code></div>"],"class":"p5.Image","module":"Image","submodule":"Image"},{"file":"src/image/p5.Image.js","line":515,"description":"<p>Copies a region of pixels from one image to another, using a specified\nblend mode to do the operation.</p>\n","itemtype":"method","name":"blend","params":[{"name":"srcImage","description":"<p>source image</p>\n","type":"p5.Image|undefined"},{"name":"sx","description":"<p>X coordinate of the source&#39;s upper left corner</p>\n","type":"Integer"},{"name":"sy","description":"<p>Y coordinate of the source&#39;s upper left corner</p>\n","type":"Integer"},{"name":"sw","description":"<p>source image width</p>\n","type":"Integer"},{"name":"sh","description":"<p>source image height</p>\n","type":"Integer"},{"name":"dx","description":"<p>X coordinate of the destination&#39;s upper left corner</p>\n","type":"Integer"},{"name":"dy","description":"<p>Y coordinate of the destination&#39;s upper left corner</p>\n","type":"Integer"},{"name":"dw","description":"<p>destination image width</p>\n","type":"Integer"},{"name":"dh","description":"<p>destination image height</p>\n","type":"Integer"},{"name":"blendMode","description":"<p>the blend mode</p>\n<p>Available blend modes are: normal | multiply | screen | overlay |\n darken | lighten | color-dodge | color-burn | hard-light |\n soft-light | difference | exclusion | hue | saturation |\n color | luminosity</p>\n<p><a href=\"http://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/\">http://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/</a></p>\n","type":"Integer"}],"example":["\n<div><code>\nvar mountains;\nvar 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</code></div>\n<div><code>\nvar mountains;\nvar 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</code></div>\n<div><code>\nvar mountains;\nvar 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</code></div>"],"class":"p5.Image","module":"Image","submodule":"Image"},{"file":"src/image/p5.Image.js","line":589,"description":"<p>Saves the image to a file and force the browser to download it.\nAccepts two strings for filename and file extension\nSupports png (default) and jpg.</p>\n","itemtype":"method","name":"save","params":[{"name":"filename","description":"<p>give your file a name</p>\n","type":"String"},{"name":"extension","description":"<p>&#39;png&#39; or &#39;jpg&#39;</p>\n","type":"String"}],"example":["\n<div><code>\nvar photo;\n\nfunction preload() {\n photo = loadImage(\"assets/rockies.jpg\");\n}\n\nfunction draw() {\n image(photo, 0, 0);\n}\n\nfunction keyTyped() {\n if (key == 's') {\n photo.save(\"photo\", \"png\");\n }\n}\n</code></div>"],"class":"p5.Image","module":"Image","submodule":"Image"},{"file":"src/image/pixels.js","line":14,"description":"<p><a href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference\n/Global_Objects/Uint8ClampedArray' target='_blank'>Uint8ClampedArray</a>\ncontaining the values for all the pixels in the display window.\nThese values are numbers. This array is the size (include an appropriate\nfactor for pixelDensity) of the display window x4,\nrepresenting the R, G, B, A values in order for each pixel, moving from\nleft to right across each row, then down each column. Retina and other\nhigh denisty displays will have more pixels[] (by a factor of\npixelDensity^2).\nFor example, if the image is 100x100 pixels, there will be 40,000. On a\nretina display, there will be 160,000.\n<br><br>\nThe first four values (indices 0-3) in the array will be the R, G, B, A\nvalues of the pixel at (0, 0). The second four values (indices 4-7) will\ncontain the R, G, B, A values of the pixel at (1, 0). More generally, to\nset values for a pixel at (x, y):\n<code><pre>\nvar d = pixelDensity;\nfor (var i = 0; i &lt; d; i++) {\n for (var j = 0; j &lt; d; j++) {\n // loop over\n idx = 4 <em> ((y </em> d + j) <em> width </em> d + (x * d + i));\n pixels[idx] = r;\n pixels[idx+1] = g;\n pixels[idx+2] = b;\n pixels[idx+3] = a;\n }\n}\n</pre></code></p>\n<p>While the above method is complex, it is flexible enough to work with\nany pixelDensity. Note that set() will automatically take care of\nsetting all the appropriate values in pixels[] for a given (x, y) at\nany pixelDensity, but the performance may not be as fast when lots of\nmodifications are made to the pixel array.\n<br><br>\nBefore accessing this array, the data must loaded with the loadPixels()\nfunction. After the array data has been modified, the updatePixels()\nfunction must be run to update the changes.\n<br><br>\nNote that this is not a standard javascript array. This means that\nstandard javascript functions such as <code>slice()</code> or\n<code>arrayCopy()</code> do not\nwork.</p>","itemtype":"property","name":"pixels[]","example":["\n<div>\n<code>\nvar pink = color(255, 102, 204);\nloadPixels();\nvar d = pixelDensity();\nvar halfImage = 4 * (width * d) * (height/2 * d);\nfor (var 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</code>\n</div>"],"class":"p5","module":"Image","submodule":"Pixels"},{"file":"src/image/pixels.js","line":80,"description":"<p>Copies a region of pixels from one image to another, using a specified\nblend mode to do the operation.<br><br>\nAvailable blend modes are: BLEND | DARKEST | LIGHTEST | DIFFERENCE |\nMULTIPLY| EXCLUSION | SCREEN | REPLACE | OVERLAY | HARD_LIGHT |\nSOFT_LIGHT | DODGE | BURN | ADD | NORMAL</p>\n","itemtype":"method","name":"blend","params":[{"name":"srcImage","description":"<p>source image</p>\n","type":"p5.Image|undefined"},{"name":"sx","description":"<p>X coordinate of the source&#39;s upper left corner</p>\n","type":"Integer"},{"name":"sy","description":"<p>Y coordinate of the source&#39;s upper left corner</p>\n","type":"Integer"},{"name":"sw","description":"<p>source image width</p>\n","type":"Integer"},{"name":"sh","description":"<p>source image height</p>\n","type":"Integer"},{"name":"dx","description":"<p>X coordinate of the destination&#39;s upper left corner</p>\n","type":"Integer"},{"name":"dy","description":"<p>Y coordinate of the destination&#39;s upper left corner</p>\n","type":"Integer"},{"name":"dw","description":"<p>destination image width</p>\n","type":"Integer"},{"name":"dh","description":"<p>destination image height</p>\n","type":"Integer"},{"name":"blendMode","description":"<p>the blend mode</p>\n","type":"Integer"}],"example":["\n<div><code>\nvar img0;\nvar img1;\n\nfunction preload() {\n img0 = loadImage(\"assets/rockies.jpg\");\n img1 = loadImage(\"assets/bricks_third.jpg\");\n}\n\nfunction setup() {\n background(img0);\n image(img1, 0, 0);\n blend(img1, 0, 0, 33, 100, 67, 0, 33, 100, LIGHTEST);\n}\n</code></div>\n<div><code>\nvar img0;\nvar img1;\n\nfunction preload() {\n img0 = loadImage(\"assets/rockies.jpg\");\n img1 = loadImage(\"assets/bricks_third.jpg\");\n}\n\nfunction setup() {\n background(img0);\n image(img1, 0, 0);\n blend(img1, 0, 0, 33, 100, 67, 0, 33, 100, DARKEST);\n}\n</code></div>\n<div><code>\nvar img0;\nvar img1;\n\nfunction preload() {\n img0 = loadImage(\"assets/rockies.jpg\");\n img1 = loadImage(\"assets/bricks_third.jpg\");\n}\n\nfunction setup() {\n background(img0);\n image(img1, 0, 0);\n blend(img1, 0, 0, 33, 100, 67, 0, 33, 100, ADD);\n}\n</code></div>"],"class":"p5","module":"Image","submodule":"Pixels"},{"file":"src/image/pixels.js","line":155,"description":"<p>Copies a region of the canvas to another region of the canvas\nand copies a region of pixels from an image used as the srcImg parameter\ninto the canvas srcImage is specified this is used as the source. If\nthe source and destination regions aren&#39;t the same size, it will\nautomatically resize source pixels to fit the specified\ntarget region.</p>\n","itemtype":"method","name":"copy","params":[{"name":"srcImage","description":"<p>source image</p>\n","type":"p5.Image|undefined"},{"name":"sx","description":"<p>X coordinate of the source&#39;s upper left corner</p>\n","type":"Integer"},{"name":"sy","description":"<p>Y coordinate of the source&#39;s upper left corner</p>\n","type":"Integer"},{"name":"sw","description":"<p>source image width</p>\n","type":"Integer"},{"name":"sh","description":"<p>source image height</p>\n","type":"Integer"},{"name":"dx","description":"<p>X coordinate of the destination&#39;s upper left corner</p>\n","type":"Integer"},{"name":"dy","description":"<p>Y coordinate of the destination&#39;s upper left corner</p>\n","type":"Integer"},{"name":"dw","description":"<p>destination image width</p>\n","type":"Integer"},{"name":"dh","description":"<p>destination image height</p>\n","type":"Integer"}],"example":["\n<div><code>\nvar img;\n\nfunction preload() {\n img = loadImage(\"assets/rockies.jpg\");\n}\n\nfunction setup() {\n background(img);\n copy(img, 7, 22, 10, 10, 35, 25, 50, 50);\n stroke(255);\n noFill();\n // Rectangle shows area being copied\n rect(7, 22, 10, 10);\n}\n</code></div>"],"class":"p5","module":"Image","submodule":"Pixels"},{"file":"src/image/pixels.js","line":196,"description":"<p>Applies a filter to the canvas.\n<br><br></p>\n<p>The presets options are:\n<br><br></p>\n<p>THRESHOLD\nConverts the image to black and white pixels depending if they are above or\nbelow the threshold defined by the level parameter. The parameter must be\nbetween 0.0 (black) and 1.0 (white). If no level is specified, 0.5 is used.\n<br><br></p>\n<p>GRAY\nConverts any colors in the image to grayscale equivalents. No parameter\nis used.\n<br><br></p>\n<p>OPAQUE\nSets the alpha channel to entirely opaque. No parameter is used.\n<br><br></p>\n<p>INVERT\nSets each pixel to its inverse value. No parameter is used.\n<br><br></p>\n<p>POSTERIZE\nLimits each channel of the image to the number of colors specified as the\nparameter. The parameter can be set to values between 2 and 255, but\nresults are most noticeable in the lower ranges.\n<br><br></p>\n<p>BLUR\nExecutes a Guassian blur with the level parameter specifying the extent\nof the blurring. If no parameter is used, the blur is equivalent to\nGuassian blur of radius 1. Larger values increase the blur.\n<br><br></p>\n<p>ERODE\nReduces the light areas. No parameter is used.\n<br><br></p>\n<p>DILATE\nIncreases the light areas. No parameter is used.</p>\n","itemtype":"method","name":"filter","params":[{"name":"filterType","description":"","type":"Constant"},{"name":"filterParam","description":"<p>an optional parameter unique\n to each filter, see above</p>\n","type":"Number"}],"example":["\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/bricks.jpg\");\n}\nfunction setup() {\n image(img, 0, 0);\n filter(THRESHOLD);\n}\n</code>\n</div>\n\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/bricks.jpg\");\n}\nfunction setup() {\n image(img, 0, 0);\n filter(GRAY);\n}\n</code>\n</div>\n\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/bricks.jpg\");\n}\nfunction setup() {\n image(img, 0, 0);\n filter(OPAQUE);\n}\n</code>\n</div>\n\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/bricks.jpg\");\n}\nfunction setup() {\n image(img, 0, 0);\n filter(INVERT);\n}\n</code>\n</div>\n\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/bricks.jpg\");\n}\nfunction setup() {\n image(img, 0, 0);\n filter(POSTERIZE,3);\n}\n</code>\n</div>\n\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/bricks.jpg\");\n}\nfunction setup() {\n image(img, 0, 0);\n filter(DILATE);\n}\n</code>\n</div>\n\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/bricks.jpg\");\n}\nfunction setup() {\n image(img, 0, 0);\n filter(BLUR,3);\n}\n</code>\n</div>\n\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/bricks.jpg\");\n}\nfunction setup() {\n image(img, 0, 0);\n filter(ERODE);\n}\n</code>\n</div>"],"class":"p5","module":"Image","submodule":"Pixels"},{"file":"src/image/pixels.js","line":356,"description":"<p>Returns an array of [R,G,B,A] values for any pixel or grabs a section of\nan image. If no parameters are specified, the entire image is returned.\nUse the x and y parameters to get the value of one pixel. Get a section of\nthe display window by specifying additional w and h parameters. When\ngetting an image, the x and y parameters define the coordinates for the\nupper-left corner of the image, regardless of the current imageMode().\n<br><br>\nIf the pixel requested is outside of the image window, [0,0,0,255] is\nreturned. To get the numbers scaled according to the current color ranges\nand taking into account colorMode, use getColor instead of get.\n<br><br>\nGetting the color of a single pixel with get(x, y) is easy, but not as fast\nas grabbing the data directly from pixels[]. The equivalent statement to\nget(x, y) using pixels[] with pixel density d is\n<code>\nvar off = (y <em> width + x) </em> d * 4;\n[pixels[off],\npixels[off+1],\npixels[off+2],\npixels[off+3]]</code>\n<br><br>\nSee the reference for pixels[] for more information.</p>\n","itemtype":"method","name":"get","params":[{"name":"x","description":"<p>x-coordinate of the pixel</p>\n","type":"Number","optional":true},{"name":"y","description":"<p>y-coordinate of the pixel</p>\n","type":"Number","optional":true},{"name":"w","description":"<p>width</p>\n","type":"Number","optional":true},{"name":"h","description":"<p>height</p>\n","type":"Number","optional":true}],"return":{"description":"values of pixel at x,y in array format\n [R, G, B, A] or p5.Image","type":"Array|p5.Image"},"example":["\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/rockies.jpg\");\n}\nfunction setup() {\n image(img, 0, 0);\n var c = get();\n image(c, width/2, 0);\n}\n</code>\n</div>\n\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/rockies.jpg\");\n}\nfunction setup() {\n image(img, 0, 0);\n var c = get(50, 90);\n fill(c);\n noStroke();\n rect(25, 25, 50, 50);\n}\n</code>\n</div>"],"class":"p5","module":"Image","submodule":"Pixels"},{"file":"src/image/pixels.js","line":422,"description":"<p>Loads the pixel data for the display window into the pixels[] array. This\nfunction must always be called before reading from or writing to pixels[].</p>\n","itemtype":"method","name":"loadPixels","example":["\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/rockies.jpg\");\n}\n\nfunction setup() {\n image(img, 0, 0);\n var d = pixelDensity();\n var halfImage = 4 * (img.width * d) *\n (img.height/2 * d);\n loadPixels();\n for (var i = 0; i < halfImage; i++) {\n pixels[i+halfImage] = pixels[i];\n }\n updatePixels();\n}\n</code>\n</div>"],"class":"p5","module":"Image","submodule":"Pixels"},{"file":"src/image/pixels.js","line":453,"description":"<p>Changes the color of any pixel, or writes an image directly to the\ndisplay window.</p>\n<p>The x and y parameters specify the pixel to change and the c parameter\nspecifies the color value. This can be a p5.Color object, or [R, G, B, A]\npixel array. It can also be a single grayscale value.\nWhen setting an image, the x and y parameters define the coordinates for\nthe upper-left corner of the image, regardless of the current imageMode().\n</p>\n<p>\nAfter using set(), you must call updatePixels() for your changes to\nappear. This should be called once all pixels have been set.\n</p>\n<p>Setting the color of a single pixel with set(x, y) is easy, but not as\nfast as putting the data directly into pixels[]. Setting the pixels[]\nvalues directly may be complicated when working with a retina display,\nbut will perform better when lots of pixels need to be set directly on\nevery loop.</p>\n<p>See the reference for pixels[] for more information.</p>","itemtype":"method","name":"set","params":[{"name":"x","description":"<p>x-coordinate of the pixel</p>\n","type":"Number"},{"name":"y","description":"<p>y-coordinate of the pixel</p>\n","type":"Number"},{"name":"c","description":"<p>insert a grayscale value | a pixel array |\n a p5.Color object | a p5.Image to copy</p>\n","type":"Number|Array|Object"}],"example":["\n<div>\n<code>\nvar black = color(0);\nset(30, 20, black);\nset(85, 20, black);\nset(85, 75, black);\nset(30, 75, black);\nupdatePixels();\n</code>\n</div>\n\n<div>\n<code>\nfor (var i = 30; i < width-15; i++) {\n for (var j = 20; j < height-25; j++) {\n var c = color(204-j, 153-i, 0);\n set(i, j, c);\n }\n}\nupdatePixels();\n</code>\n</div>\n\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/rockies.jpg\");\n}\n\nfunction setup() {\n set(0, 0, img);\n updatePixels();\n line(0, 0, width, height);\n line(0, height, width, 0);\n}\n</code>\n</div>"],"class":"p5","module":"Image","submodule":"Pixels"},{"file":"src/image/pixels.js","line":521,"description":"<p>Updates the display window with the data in the pixels[] array.\nUse in conjunction with loadPixels(). If you&#39;re only reading pixels from\nthe array, there&#39;s no need to call updatePixels() — updating is only\nnecessary to apply changes. updatePixels() should be called anytime the\npixels array is manipulated or set() is called.</p>\n","itemtype":"method","name":"updatePixels","params":[{"name":"x","description":"<p>x-coordinate of the upper-left corner of region\n to update</p>\n","type":"Number","optional":true},{"name":"y","description":"<p>y-coordinate of the upper-left corner of region\n to update</p>\n","type":"Number","optional":true},{"name":"w","description":"<p>width of region to update</p>\n","type":"Number","optional":true},{"name":"w","description":"<p>height of region to update</p>\n","type":"Number","optional":true}],"example":["\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage(\"assets/rockies.jpg\");\n}\n\nfunction setup() {\n image(img, 0, 0);\n var halfImage = 4 * (img.width * pixelDensity()) *\n (img.height * pixelDensity()/2);\n loadPixels();\n for (var i = 0; i < halfImage; i++) {\n pixels[i+halfImage] = pixels[i];\n }\n updatePixels();\n}\n</code>\n</div>"],"class":"p5","module":"Image","submodule":"Pixels"},{"file":"src/io/files.js","line":16,"description":"<p>Checks if we are in preload and returns the last arg which will be the\n_decrementPreload function if called from a loadX() function. Should\nonly be used in loadX() functions.</p>\n","access":"private","tagname":"","class":"p5","module":"IO","submodule":"Input"},{"file":"src/io/files.js","line":35,"description":"<p>Loads an opentype font file (.otf, .ttf) from a file or a URL,\nand returns a PFont Object. This method is asynchronous,\nmeaning it may not finish before the next line in your sketch\nis executed.\n<br><br>\nThe path to the font should be relative to the HTML file\nthat links in your sketch. Loading an from a URL or other\nremote location may be blocked due to your browser&#39;s built-in\nsecurity.</p>\n","itemtype":"method","name":"loadFont","params":[{"name":"path","description":"<p>name of the file or url to load</p>\n","type":"String"},{"name":"callback","description":"<p>function to be executed after\n loadFont()\n completes</p>\n","type":"Function","optional":true}],"return":{"description":"p5.Font object","type":"Object"},"example":["\n\n<p>Calling loadFont() inside preload() guarantees that the load\noperation will have completed before setup() and draw() are called.</p>\n\n<div><code>\nvar myFont;\nfunction preload() {\n myFont = loadFont('assets/AvenirNextLTPro-Demi.otf');\n}\n\nfunction setup() {\n fill('#ED225D');\n textFont(myFont);\n textSize(36);\n text('p5*js', 10, 50);\n}\n</code></div>\n\nOutside of preload(), you may supply a callback function to handle the\nobject:\n\n<div><code>\nfunction setup() {\n loadFont('assets/AvenirNextLTPro-Demi.otf', drawText);\n}\n\nfunction drawText(font) {\n fill('#ED225D');\n textFont(font, 36);\n text('p5*js', 10, 50);\n}\n\n</code></div>\n\n<p>You can also use the string name of the font to style other HTML\nelements.</p>\n\n<div><code>\nvar myFont;\n\nfunction preload() {\n myFont = loadFont('assets/Avenir.otf');\n}\n\nfunction setup() {\n var myDiv = createDiv('hello there');\n myDiv.style('font-family', 'Avenir');\n}\n</code></div>"],"class":"p5","module":"IO","submodule":"Input"},{"file":"src/io/files.js","line":165,"description":"<p>Loads a JSON file from a file or a URL, and returns an Object or Array.\nThis method is asynchronous, meaning it may not finish before the next\nline in your sketch is executed.</p>\n","itemtype":"method","name":"loadJSON","params":[{"name":"path","description":"<p>name of the file or url to load</p>\n","type":"String"},{"name":"callback","description":"<p>function to be executed after\n loadJSON() completes, data is passed\n in as first argument</p>\n","type":"Function","optional":true},{"name":"errorCallback","description":"<p>function to be executed if\n there is an error, response is passed\n in as first argument</p>\n","type":"Function","optional":true},{"name":"datatype","description":"<p>&quot;json&quot; or &quot;jsonp&quot;</p>\n","type":"String","optional":true}],"return":{"description":"JSON data","type":"Object|Array"},"example":["\n\n<p>Calling loadJSON() inside preload() guarantees to complete the\noperation before setup() and draw() are called.</p>\n\n<div><code>\nvar weather;\nfunction preload() {\n var url = 'http://api.openweathermap.org/data/2.5/weather?q=London,UK'+\n '&APPID=7bbbb47522848e8b9c26ba35c226c734';\n weather = loadJSON(url);\n}\n\nfunction setup() {\n noLoop();\n}\n\nfunction draw() {\n background(200);\n // get the humidity value out of the loaded JSON\n var humidity = weather.main.humidity;\n fill(0, humidity); // use the humidity value to set the alpha\n ellipse(width/2, height/2, 50, 50);\n}\n</code></div>\n\n\n<p>Outside of preload(), you may supply a callback function to handle the\nobject:</p>\n<div><code>\nfunction setup() {\n noLoop();\n var url = 'http://api.openweathermap.org/data/2.5/weather?q=NewYork'+\n '&APPID=7bbbb47522848e8b9c26ba35c226c734';\n loadJSON(url, drawWeather);\n}\n\nfunction draw() {\n background(200);\n}\n\nfunction drawWeather(weather) {\n // get the humidity value out of the loaded JSON\n var humidity = weather.main.humidity;\n fill(0, humidity); // use the humidity value to set the alpha\n ellipse(width/2, height/2, 50, 50);\n}\n</code></div>\n"],"class":"p5","module":"IO","submodule":"Input"},{"file":"src/io/files.js","line":280,"description":"<p>Reads the contents of a file and creates a String array of its individual\nlines. If the name of the file is used as the parameter, as in the above\nexample, the file must be located in the sketch directory/folder.\n<br><br>\nAlternatively, the file maybe be loaded from anywhere on the local\ncomputer using an absolute path (something that starts with / on Unix and\nLinux, or a drive letter on Windows), or the filename parameter can be a\nURL for a file found on a network.\n<br><br>\nThis method is asynchronous, meaning it may not finish before the next\nline in your sketch is executed.</p>\n","itemtype":"method","name":"loadStrings","params":[{"name":"filename","description":"<p>name of the file or url to load</p>\n","type":"String"},{"name":"callback","description":"<p>function to be executed after loadStrings()\n completes, Array is passed in as first\n argument</p>\n","type":"Function","optional":true},{"name":"errorCallback","description":"<p>function to be executed if\n there is an error, response is passed\n in as first argument</p>\n","type":"Function","optional":true}],"return":{"description":"Array of Strings","type":"Array"},"example":["\n\n<p>Calling loadStrings() inside preload() guarantees to complete the\noperation before setup() and draw() are called.</p>\n\n<div><code>\nvar result;\nfunction preload() {\n result = loadStrings('assets/test.txt');\n}\n\nfunction setup() {\n background(200);\n var ind = floor(random(result.length));\n text(result[ind], 10, 10, 80, 80);\n}\n</code></div>\n\n<p>Outside of preload(), you may supply a callback function to handle the\nobject:</p>\n\n<div><code>\nfunction setup() {\n loadStrings('assets/test.txt', pickString);\n}\n\nfunction pickString(result) {\n background(200);\n var ind = floor(random(result.length));\n text(result[ind], 10, 10, 80, 80);\n}\n</code></div>"],"class":"p5","module":"IO","submodule":"Input"},{"file":"src/io/files.js","line":376,"description":"<p>Reads the contents of a file or URL and creates a p5.Table object with\nits values. If a file is specified, it must be located in the sketch&#39;s\n&quot;data&quot; folder. The filename parameter can also be a URL to a file found\nonline. By default, the file is assumed to be comma-separated (in CSV\nformat). Table only looks for a header row if the &#39;header&#39; option is\nincluded.</p>\n\n<p>Possible options include:\n<ul>\n<li>csv - parse the table as comma-separated values</li>\n<li>tsv - parse the table as tab-separated values</li>\n<li>header - this table has a header (title) row</li>\n</ul>\n</p>\n\n<p>When passing in multiple options, pass them in as separate parameters,\nseperated by commas. For example:\n<br><br>\n<code>\n loadTable(&quot;my_csv_file.csv&quot;, &quot;csv&quot;, &quot;header&quot;)\n</code>\n</p>\n\n<p> All files loaded and saved use UTF-8 encoding.</p>\n\n<p>This method is asynchronous, meaning it may not finish before the next\nline in your sketch is executed. Calling loadTable() inside preload()\nguarantees to complete the operation before setup() and draw() are called.\n<p>Outside of preload(), you may supply a callback function to handle the\nobject:</p>\n</p>","itemtype":"method","name":"loadTable","params":[{"name":"filename","description":"<p>name of the file or URL to load</p>\n","type":"String"},{"name":"options","description":"<p>&quot;header&quot; &quot;csv&quot; &quot;tsv&quot;</p>\n","type":"String|Strings","optional":true},{"name":"callback","description":"<p>function to be executed after\n loadTable() completes. On success, the\n Table object is passed in as the\n first argument; otherwise, false\n is passed in.</p>\n","type":"Function","optional":true}],"return":{"description":"Table object containing data","type":"Object"},"example":["\n<div class=\"norender\">\n<code>\n// Given the following CSV file called \"mammals.csv\"\n// located in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nvar table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable(\"assets/mammals.csv\", \"csv\", \"header\");\n //the file can be remote\n //table = loadTable(\"http://p5js.org/reference/assets/mammals.csv\",\n // \"csv\", \"header\");\n}\n\nfunction setup() {\n //count the columns\n println(table.getRowCount() + \" total rows in table\");\n println(table.getColumnCount() + \" total columns in table\");\n\n println(table.getColumn(\"name\"));\n //[\"Goat\", \"Leopard\", \"Zebra\"]\n\n //cycle through the table\n for (var r = 0; r < table.getRowCount(); r++)\n for (var c = 0; c < table.getColumnCount(); c++) {\n println(table.getString(r, c));\n }\n}\n</code>\n</div>"],"class":"p5","module":"IO","submodule":"Input"},{"file":"src/io/files.js","line":684,"description":"<p>Reads the contents of a file and creates an XML object with its values.\nIf the name of the file is used as the parameter, as in the above example,\nthe file must be located in the sketch directory/folder.</p>\n<p>Alternatively, the file maybe be loaded from anywhere on the local\ncomputer using an absolute path (something that starts with / on Unix and\nLinux, or a drive letter on Windows), or the filename parameter can be a\nURL for a file found on a network.</p>\n<p>This method is asynchronous, meaning it may not finish before the next\nline in your sketch is executed. Calling loadXML() inside preload()\nguarantees to complete the operation before setup() and draw() are called.</p>\n<p>Outside of preload(), you may supply a callback function to handle the\nobject:</p>","itemtype":"method","name":"loadXML","params":[{"name":"filename","description":"<p>name of the file or URL to load</p>\n","type":"String"},{"name":"callback","description":"<p>function to be executed after loadXML()\n completes, XML object is passed in as\n first argument</p>\n","type":"Function","optional":true},{"name":"errorCallback","description":"<p>function to be executed if\n there is an error, response is passed\n in as first argument</p>\n","type":"Function","optional":true}],"return":{"description":"XML object containing data","type":"Object"},"class":"p5","module":"IO","submodule":"Input"},{"file":"src/io/files.js","line":761,"description":"<p>Method for executing an HTTP GET request. If data type is not specified,\np5 will try to guess based on the URL, defaulting to text.</p>\n","itemtype":"method","name":"httpGet","params":[{"name":"path","description":"<p>name of the file or url to load</p>\n","type":"String"},{"name":"data","description":"<p>param data passed sent with request</p>\n","type":"Object","optional":true},{"name":"datatype","description":"<p>&quot;json&quot;, &quot;jsonp&quot;, &quot;xml&quot;, or &quot;text&quot;</p>\n","type":"String","optional":true},{"name":"callback","description":"<p>function to be executed after\n httpGet() completes, data is passed in\n as first argument</p>\n","type":"Function","optional":true},{"name":"errorCallback","description":"<p>function to be executed if\n there is an error, response is passed\n in as first argument</p>\n","type":"Function","optional":true}],"class":"p5","module":"IO","submodule":"Input"},{"file":"src/io/files.js","line":785,"description":"<p>Method for executing an HTTP POST request. If data type is not specified,\np5 will try to guess based on the URL, defaulting to text.</p>\n","itemtype":"method","name":"httpPost","params":[{"name":"path","description":"<p>name of the file or url to load</p>\n","type":"String"},{"name":"data","description":"<p>param data passed sent with request</p>\n","type":"Object","optional":true},{"name":"datatype","description":"<p>&quot;json&quot;, &quot;jsonp&quot;, &quot;xml&quot;, or &quot;text&quot;</p>\n","type":"String","optional":true},{"name":"callback","description":"<p>function to be executed after\n httpGet() completes, data is passed in\n as first argument</p>\n","type":"Function","optional":true},{"name":"errorCallback","description":"<p>function to be executed if\n there is an error, response is passed\n in as first argument</p>\n","type":"Function","optional":true}],"class":"p5","module":"IO","submodule":"Input"},{"file":"src/io/files.js","line":809,"description":"<p>Method for executing an HTTP request. If data type is not specified,\np5 will try to guess based on the URL, defaulting to text.<br><br>\nYou may also pass a single object specifying all parameters for the\nrequest following the examples inside the reqwest() calls here:\n<a href='https://github.com/ded/reqwest#api'>\nhttps://github.com/ded/reqwest#api</a></p>\n","itemtype":"method","name":"httpDo","params":[{"name":"path","description":"<p>name of the file or url to load</p>\n","type":"String"},{"name":"method","description":"<p>either &quot;GET&quot;, &quot;POST&quot;, or &quot;PUT&quot;,\n defaults to &quot;GET&quot;</p>\n","type":"String","optional":true},{"name":"data","description":"<p>param data passed sent with request</p>\n","type":"Object","optional":true},{"name":"datatype","description":"<p>&quot;json&quot;, &quot;jsonp&quot;, &quot;xml&quot;, or &quot;text&quot;</p>\n","type":"String","optional":true},{"name":"callback","description":"<p>function to be executed after\n httpGet() completes, data is passed in\n as first argument</p>\n","type":"Function","optional":true},{"name":"errorCallback","description":"<p>function to be executed if\n there is an error, response is passed\n in as first argument</p>\n","type":"Function","optional":true}],"class":"p5","module":"IO","submodule":"Input"},{"file":"src/io/files.js","line":995,"description":"<p>Save an image, text, json, csv, wav, or html. Prompts download to\nthe client&#39;s computer. <b>Note that it is not recommended to call save()\nwithin draw if it&#39;s looping, as the save() function will open a new save\ndialog every frame.</b></p>\n<p>The default behavior is to save the canvas as an image. You can\noptionally specify a filename.\nFor example:</p>\n<pre class='language-javascript'><code>\nsave();\nsave(&#39;myCanvas.jpg&#39;); // save a specific canvas with a filename\n</code></pre>\n\n<p>Alternately, the first parameter can be a pointer to a canvas\np5.Element, an Array of Strings,\nan Array of JSON, a JSON object, a p5.Table, a p5.Image, or a\np5.SoundFile (requires p5.sound). The second parameter is a filename\n(including extension). The third parameter is for options specific\nto this type of object. This method will save a file that fits the\ngiven paramaters. For example:</p>\n\n<pre class='language-javascript'><code>\n\nsave('myCanvas.jpg'); // Saves canvas as an image\n\nvar cnv = createCanvas(100, 100);\nsave(cnv, 'myCanvas.jpg'); // Saves canvas as an image\n\nvar gb = createGraphics(100, 100);\nsave(gb, 'myGraphics.jpg'); // Saves p5.Renderer object as an image\n\nsave(myTable, 'myTable.html'); // Saves table as html file\nsave(myTable, 'myTable.csv',); // Comma Separated Values\nsave(myTable, 'myTable.tsv'); // Tab Separated Values\n\nsave(myJSON, 'my.json'); // Saves pretty JSON\nsave(myJSON, 'my.json', true); // Optimizes JSON filesize\n\nsave(img, 'my.png'); // Saves pImage as a png image\n\nsave(arrayOfStrings, 'my.txt'); // Saves strings to a text file with line\n // breaks after each item in the array\n</code></pre>","itemtype":"method","name":"save","params":[{"name":"objectOrFilename","description":"<p>If filename is provided, will\n save canvas as an image with\n either png or jpg extension\n depending on the filename.\n If object is provided, will\n save depending on the object\n and filename (see examples\n above).</p>\n","type":"[Object|String]"},{"name":"filename","description":"<p>If an object is provided as the first\n parameter, then the second parameter\n indicates the filename,\n and should include an appropriate\n file extension (see examples above).</p>\n","type":"[String]"},{"name":"options","description":"<p>Additional options depend on\n filetype. For example, when saving JSON,\n <code>true</code> indicates that the\n output will be optimized for filesize,\n rather than readability.</p>\n","type":"[Boolean/String]"}],"class":"p5","module":"IO","submodule":"Output"},{"file":"src/io/files.js","line":1112,"description":"<p>Writes the contents of an Array or a JSON object to a .json file.\nThe file saving process and location of the saved file will\nvary between web browsers.</p>\n","itemtype":"method","name":"saveJSON","params":[{"name":"json","description":"","type":"Array|Object"},{"name":"filename","description":"","type":"String"},{"name":"optimize","description":"<p>If true, removes line breaks\n and spaces from the output\n file to optimize filesize\n (but not readability).</p>\n","type":"Boolean","optional":true}],"example":["\n<div><code>\nvar json;\n\nfunction setup() {\n\n json = {}; // new JSON Object\n\n json.id = 0;\n json.species = 'Panthera leo';\n json.name = 'Lion';\n\n// To save, un-comment the line below, then click 'run'\n// saveJSON(json, 'lion.json');\n}\n\n// Saves the following to a file called \"lion.json\":\n// {\n// \"id\": 0,\n// \"species\": \"Panthera leo\",\n// \"name\": \"Lion\"\n// }\n</div></code>"],"class":"p5","module":"IO","submodule":"Output"},{"file":"src/io/files.js","line":1168,"description":"<p>Writes an array of Strings to a text file, one line per String.\nThe file saving process and location of the saved file will\nvary between web browsers.</p>\n","itemtype":"method","name":"saveStrings","params":[{"name":"list","description":"<p>string array to be written</p>\n","type":"Array"},{"name":"filename","description":"<p>filename for output</p>\n","type":"String"}],"example":["\n<div><code>\nvar words = 'apple bear cat dog';\n\n// .split() outputs an Array\nvar list = split(words, ' ');\n\n// To save the file, un-comment next line and click 'run'\n// saveStrings(list, 'nouns.txt');\n\n// Saves the following to a file called 'nouns.txt':\n//\n// apple\n// bear\n// cat\n// dog\n</code></div>"],"class":"p5","module":"IO","submodule":"Output"},{"file":"src/io/files.js","line":1233,"description":"<p>Writes the contents of a Table object to a file. Defaults to a\ntext file with comma-separated-values (&#39;csv&#39;) but can also\nuse tab separation (&#39;tsv&#39;), or generate an HTML table (&#39;html&#39;).\nThe file saving process and location of the saved file will\nvary between web browsers.</p>\n","itemtype":"method","name":"saveTable","params":[{"name":"Table","description":"<p>the Table object to save to a file</p>\n","type":"p5.Table"},{"name":"filename","description":"<p>the filename to which the Table should be saved</p>\n","type":"String"},{"name":"options","description":"<p>can be one of &quot;tsv&quot;, &quot;csv&quot;, or &quot;html&quot;</p>\n","type":"String","optional":true}],"example":["\n<div><code>\nvar table;\n\nfunction setup() {\n table = new p5.Table();\n\n table.addColumn('id');\n table.addColumn('species');\n table.addColumn('name');\n\n var newRow = table.addRow();\n newRow.setNum('id', table.getRowCount() - 1);\n newRow.setString('species', 'Panthera leo');\n newRow.setString('name', 'Lion');\n\n // To save, un-comment next line then click 'run'\n // saveTable(table, 'new.csv');\n }\n\n // Saves the following to a file called 'new.csv':\n // id,species,name\n // 0,Panthera leo,Lion\n</code></div>"],"class":"p5","module":"IO","submodule":"Output"},{"file":"src/io/files.js","line":1348,"description":"<p>Generate a blob of file data as a url to prepare for download.\nAccepts an array of data, a filename, and an extension (optional).\nThis is a private function because it does not do any formatting,\nbut it is used by saveStrings, saveJSON, saveTable etc.</p>\n","params":[{"name":"dataToDownload","description":"","type":"Array"},{"name":"filename","description":"","type":"String"},{"name":"extension","description":"","type":"[String]"}],"access":"private","tagname":"","class":"p5","module":"IO","submodule":"Output"},{"file":"src/io/files.js","line":1371,"description":"<p>Forces download. Accepts a url to filedata/blob, a filename,\nand an extension (optional).\nThis is a private function because it does not do any formatting,\nbut it is used by saveStrings, saveJSON, saveTable etc.</p>\n","params":[{"name":"href","description":"<p>i.e. an href generated by createObjectURL</p>\n","type":"String"},{"name":"filename","description":"","type":"[String]"},{"name":"extension","description":"","type":"[String]"}],"class":"p5","module":"IO","submodule":"Output"},{"file":"src/io/files.js","line":1407,"description":"<p>Returns a file extension, or another string\nif the provided parameter has no extension.</p>\n","params":[{"name":"filename","description":"","type":"String"}],"return":{"description":"[fileName, fileExtension]","type":"Array"},"access":"private","tagname":"","class":"p5","module":"IO","submodule":"Output"},{"file":"src/io/files.js","line":1439,"description":"<p>Returns true if the browser is Safari, false if not.\nSafari makes trouble for downloading files.</p>\n","return":{"description":"[description]","type":"Boolean"},"access":"private","tagname":"","class":"p5","module":"IO","submodule":"Output"},{"file":"src/io/files.js","line":1451,"description":"<p>Helper function, a callback for download that deletes\nan invisible anchor element from the DOM once the file\nhas been automatically downloaded.</p>\n","access":"private","tagname":"","class":"p5","module":"IO","submodule":"Output"},{"file":"src/io/p5.Table.js","line":12,"description":"<p>Table Options</p>\n<p>Generic class for handling tabular data, typically from a\nCSV, TSV, or other sort of spreadsheet file.</p>\n<p>CSV files are\n<a href=\"http://en.wikipedia.org/wiki/Comma-separated_values\">\ncomma separated values</a>, often with the data in quotes. TSV\nfiles use tabs as separators, and usually don&#39;t bother with the\nquotes.</p>\n<p>File names should end with .csv if they&#39;re comma separated.</p>\n<p>A rough &quot;spec&quot; for CSV can be found\n<a href=\"http://tools.ietf.org/html/rfc4180\">here</a>.</p>\n<p>To load files, use the loadTable method.</p>\n<p>To save tables to your computer, use the save method\n or the saveTable method.</p>\n\n<p>Possible options include:</p>\n<ul>\n<li>csv - parse the table as comma-separated values\n<li>tsv - parse the table as tab-separated values\n<li>header - this table has a header (title) row\n</ul>","class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":47,"itemtype":"property","name":"columns","type":"{Array}","class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":53,"itemtype":"property","name":"rows","type":"{Array}","class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":60,"description":"<p>Use addRow() to add a new row of data to a p5.Table object. By default,\nan empty row is created. Typically, you would store a reference to\nthe new row in a TableRow object (see newRow in the example above),\nand then set individual values using set().</p>\n<p>If a p5.TableRow object is included as a parameter, then that row is\nduplicated and added to the table.</p>\n","itemtype":"method","name":"addRow","params":[{"name":"row","description":"<p>row to be added to the table</p>\n","type":"p5.TableRow","optional":true}],"example":["\n <div class=\"norender\">\n <code>\n // Given the CSV file \"mammals.csv\"\n // in the project's \"assets\" folder:\n //\n // id,species,name\n // 0,Capra hircus,Goat\n // 1,Panthera pardus,Leopard\n // 2,Equus zebra,Zebra\n\n var table;\n\n function preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable(\"assets/mammals.csv\", \"csv\", \"header\");\n }\n\n function setup() {\n //add a row\n var 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 (var r = 0; r < table.getRowCount(); r++)\n for (var c = 0; c < table.getColumnCount(); c++)\n println(table.getString(r, c));\n }\n </code>\n </div>"],"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":119,"description":"<p>Removes a row from the table object.</p>\n","itemtype":"method","name":"removeRow","params":[{"name":"id","description":"<p>ID number of the row to remove</p>\n","type":"Number"}],"example":["\n<div class=\"norender\">\n<code>\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nvar table;\n\nfunction preload() {\n //my table is comma separated 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 var r = table.removeRow(0);\n\n //print the results\n for (var r = 0; r < table.getRowCount(); r++)\n for (var c = 0; c < table.getColumnCount(); c++)\n println(table.getString(r, c));\n}\n</code>\n</div>"],"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":164,"description":"<p>Returns a reference to the specified p5.TableRow. The reference\ncan then be used to get and set values of the selected row.</p>\n","itemtype":"method","name":"getRow","params":[{"name":"rowID","description":"<p>ID number of the row to get</p>\n","type":"Number"}],"return":{"description":"p5.TableRow object","type":"TableRow"},"example":["\n<div class=\"norender\">\n<code>\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nvar table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable(\"assets/mammals.csv\", \"csv\", \"header\");\n}\n\nfunction setup() {\n var row = table.getRow(1);\n //print it column by column\n //note: a row is an object, not an array\n for (var c = 0; c < table.getColumnCount(); c++)\n println(row.getString(c));\n}\n</code>\n</div>"],"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":205,"description":"<p>Gets all rows from the table. Returns an array of p5.TableRows.</p>\n","itemtype":"method","name":"getRows","return":{"description":"Array of p5.TableRows","type":"Array"},"example":["\n <div class=\"norender\">\n <code>\n // Given the CSV file \"mammals.csv\"\n // in the project's \"assets\" folder:\n //\n // id,species,name\n // 0,Capra hircus,Goat\n // 1,Panthera pardus,Leopard\n // 2,Equus zebra,Zebra\n\n var table;\n\n function preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable(\"assets/mammals.csv\", \"csv\", \"header\");\n }\n\n function setup() {\n var rows = table.getRows();\n\n //warning: rows is an array of objects\n for (var r = 0; r < rows.length; r++)\n rows[r].set(\"name\", \"Unicorn\");\n\n //print the results\n for (var r = 0; r < table.getRowCount(); r++)\n for (var c = 0; c < table.getColumnCount(); c++)\n println(table.getString(r, c));\n }\n </code>\n </div>"],"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":249,"description":"<p>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.</p>\n","itemtype":"method","name":"findRow","params":[{"name":"value","description":"<p>The value to match</p>\n","type":"String"},{"name":"column","description":"<p>ID number or title of the\n column to search</p>\n","type":"Number|String"}],"return":{"description":"","type":"TableRow"},"example":["\n <div class=\"norender\">\n <code>\n // Given the CSV file \"mammals.csv\"\n // in the project's \"assets\" folder:\n //\n // id,species,name\n // 0,Capra hircus,Goat\n // 1,Panthera pardus,Leopard\n // 2,Equus zebra,Zebra\n\n var table;\n\n function preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable(\"assets/mammals.csv\", \"csv\", \"header\");\n }\n\n function setup() {\n //find the animal named zebra\n var row = table.findRow(\"Zebra\", \"name\");\n //find the corresponding species\n println(row.getString(\"species\"));\n }\n </code>\n </div>"],"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":311,"description":"<p>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.</p>\n","itemtype":"method","name":"findRows","params":[{"name":"value","description":"<p>The value to match</p>\n","type":"String"},{"name":"column","description":"<p>ID number or title of the\n column to search</p>\n","type":"Number|String"}],"return":{"description":"An Array of TableRow objects","type":"Array"},"example":["\n <div class=\"norender\">\n <code>\n // Given the CSV file \"mammals.csv\"\n // in the project's \"assets\" folder:\n //\n // id,species,name\n // 0,Capra hircus,Goat\n // 1,Panthera pardus,Leopard\n // 2,Equus zebra,Zebra\n\n var table;\n\n function preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable(\"assets/mammals.csv\", \"csv\", \"header\");\n }\n\n function setup() {\n //add another goat\n var 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 var rows = table.findRows(\"Goat\", \"name\");\n println(rows.length + \" Goats found\");\n }\n </code>\n </div>"],"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":377,"description":"<p>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.</p>\n","itemtype":"method","name":"matchRow","params":[{"name":"regexp","description":"<p>The regular expression to match</p>\n","type":"String"},{"name":"column","description":"<p>The column ID (number) or\n title (string)</p>\n","type":"String|Number"}],"return":{"description":"TableRow object","type":"TableRow"},"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":409,"description":"<p>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.</p>\n","itemtype":"method","name":"matchRows","params":[{"name":"regexp","description":"<p>The regular expression to match</p>\n","type":"String"},{"name":"column","description":"<p>The column ID (number) or\n title (string)</p>\n","type":"String|Number","optional":true}],"return":{"description":"An Array of TableRow objects","type":"Array"},"example":["\nvar table;\n\nfunction setup() {\n\n table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n var 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 var rows = table.matchRows('R.*', 'type');\n for (var i = 0; i < rows.length; i++) {\n println(rows[i].getString('name') + ': ' + rows[i].getString('type'));\n }\n}\n// Sketch prints:\n// Snake: Reptile\n// Lizard: Reptile"],"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":476,"description":"<p>Retrieves all values in the specified column, and returns them\nas an array. The column may be specified by either its ID or title.</p>\n","itemtype":"method","name":"getColumn","params":[{"name":"column","description":"<p>String or Number of the column to return</p>\n","type":"String|Number"}],"return":{"description":"Array of column values","type":"Array"},"example":["\n <div class=\"norender\">\n <code>\n // Given the CSV file \"mammals.csv\"\n // in the project's \"assets\" folder:\n //\n // id,species,name\n // 0,Capra hircus,Goat\n // 1,Panthera pardus,Leopard\n // 2,Equus zebra,Zebra\n\n var table;\n\n function preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable(\"assets/mammals.csv\", \"csv\", \"header\");\n }\n\n function setup() {\n //getColumn returns an array that can be printed directly\n println(table.getColumn(\"species\"));\n //outputs [\"Capra hircus\", \"Panthera pardus\", \"Equus zebra\"]\n }\n </code>\n </div>"],"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":525,"description":"<p>Removes all rows from a Table. While all rows are removed,\ncolumns and column titles are maintained.</p>\n","itemtype":"method","name":"clearRows","example":["\n <div class=\"norender\">\n <code>\n // Given the CSV file \"mammals.csv\"\n // in the project's \"assets\" folder:\n //\n // id,species,name\n // 0,Capra hircus,Goat\n // 1,Panthera pardus,Leopard\n // 2,Equus zebra,Zebra\n\n var table;\n\n function preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable(\"assets/mammals.csv\", \"csv\", \"header\");\n }\n\n function setup() {\n table.clearRows();\n println(table.getRowCount() + \" total rows in table\");\n println(table.getColumnCount() + \" total columns in table\");\n }\n </code>\n </div>"],"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":563,"description":"<p>Use addColumn() to add a new column to a Table object.\nTypically, you will want to specify a title, so the column\nmay be easily referenced later by name. (If no title is\nspecified, the new column&#39;s title will be null.)</p>\n","itemtype":"method","name":"addColumn","params":[{"name":"title","description":"<p>title of the given column</p>\n","type":"String","optional":true}],"example":["\n <div class=\"norender\">\n <code>\n // Given the CSV file \"mammals.csv\"\n // in the project's \"assets\" folder:\n //\n // id,species,name\n // 0,Capra hircus,Goat\n // 1,Panthera pardus,Leopard\n // 2,Equus zebra,Zebra\n\n var table;\n\n function preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable(\"assets/mammals.csv\", \"csv\", \"header\");\n }\n\n function 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 (var r = 0; r < table.getRowCount(); r++)\n for (var c = 0; c < table.getColumnCount(); c++)\n println(table.getString(r, c));\n }\n </code>\n </div>"],"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":610,"description":"<p>Returns the total number of columns in a Table.</p>\n","return":{"description":"Number of columns in this table","type":"Number"},"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":619,"description":"<p>Returns the total number of rows in a Table.</p>\n","itemtype":"method","name":"getRowCount","return":{"description":"Number of rows in this table","type":"Number"},"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":630,"description":"<p>Removes any of the specified characters (or &quot;tokens&quot;).</p>\n\n<p>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.</p>","itemtype":"method","name":"removeTokens","params":[{"name":"chars","description":"<p>String listing characters to be removed</p>\n","type":"String"},{"name":"column","description":"<p>Column ID (number)\n or name (string)</p>\n","type":"String|Number","optional":true}],"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":681,"description":"<p>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.</p>\n","itemtype":"method","name":"trim","params":[{"name":"column","description":"<p>Column ID (number)\n or name (string)</p>\n","type":"String|Number"}],"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":723,"description":"<p>Use removeColumn() to remove an existing column from a Table\nobject. The column to be removed may be identified by either\nits title (a String) or its index value (an int).\nremoveColumn(0) would remove the first column, removeColumn(1)\nwould remove the second column, and so on.</p>\n","itemtype":"method","name":"removeColumn","params":[{"name":"column","description":"<p>columnName (string) or ID (number)</p>\n","type":"String|Number"}],"example":["\n <div class=\"norender\">\n <code>\n // Given the CSV file \"mammals.csv\"\n // in the project's \"assets\" folder:\n //\n // id,species,name\n // 0,Capra hircus,Goat\n // 1,Panthera pardus,Leopard\n // 2,Equus zebra,Zebra\n\n var table;\n\n function preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable(\"assets/mammals.csv\", \"csv\", \"header\");\n }\n\n function setup() {\n table.removeColumn(\"id\");\n println(table.getColumnCount());\n }\n </code>\n </div>"],"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":788,"description":"<p>Stores a value in the Table&#39;s specified row and column.\nThe row is specified by its ID, while the column may be specified\nby either its ID or title.</p>\n","itemtype":"method","name":"set","params":[{"name":"column","description":"<p>column ID (Number)\n or title (String)</p>\n","type":"String|Number"},{"name":"value","description":"<p>value to assign</p>\n","type":"String|Number"}],"example":["\n<div class=\"norender\">\n<code>\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nvar table;\n\nfunction preload() {\n //my table is comma separated value \"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 (var r = 0; r < table.getRowCount(); r++)\n for (var c = 0; c < table.getColumnCount(); c++)\n println(table.getString(r, c));\n}\n</code>\n</div>"],"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":833,"description":"<p>Stores a Float value in the Table&#39;s specified row and column.\nThe row is specified by its ID, while the column may be specified\nby either its ID or title.</p>\n","itemtype":"method","name":"setNum","params":[{"name":"row","description":"<p>row ID</p>\n","type":"Number"},{"name":"column","description":"<p>column ID (Number)\n or title (String)</p>\n","type":"String|Number"},{"name":"value","description":"<p>value to assign</p>\n","type":"Number"}],"example":["\n<div class=\"norender\">\n<code>\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nvar table;\n\nfunction preload() {\n //my table is comma separated value \"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 println(table.getColumn(0));\n //[\"0\", 1, \"2\"]\n}\n</code>\n</div>"],"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":877,"description":"<p>Stores a String value in the Table&#39;s specified row and column.\nThe row is specified by its ID, while the column may be specified\nby either its ID or title.</p>\n","itemtype":"method","name":"setString","params":[{"name":"row","description":"<p>row ID</p>\n","type":"Number"},{"name":"column","description":"<p>column ID (Number)\n or title (String)</p>\n","type":"String|Number"},{"name":"value","description":"<p>value to assign</p>\n","type":"String"}],"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":892,"description":"<p>Retrieves a value from the Table&#39;s specified row and column.\nThe row is specified by its ID, while the column may be specified by\neither its ID or title.</p>\n","itemtype":"method","name":"get","params":[{"name":"row","description":"<p>row ID</p>\n","type":"Number"},{"name":"column","description":"<p>columnName (string) or\n ID (number)</p>\n","type":"String|Number"}],"return":{"description":"","type":"String|Number"},"example":["\n<div class=\"norender\">\n<code>\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nvar table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable(\"assets/mammals.csv\", \"csv\", \"header\");\n}\n\nfunction setup() {\n println(table.get(0, 1));\n //Capra hircus\n println(table.get(0, \"species\"));\n //Capra hircus\n}\n</code>\n</div>"],"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":935,"description":"<p>Retrieves a Float value from the Table&#39;s specified row and column.\nThe row is specified by its ID, while the column may be specified by\neither its ID or title.</p>\n","itemtype":"method","name":"getNum","params":[{"name":"row","description":"<p>row ID</p>\n","type":"Number"},{"name":"column","description":"<p>columnName (string) or\n ID (number)</p>\n","type":"String|Number"}],"return":{"description":"","type":"Number"},"example":["\n<div class=\"norender\">\n<code>\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nvar table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable(\"assets/mammals.csv\", \"csv\", \"header\");\n}\n\nfunction setup() {\n println(table.getNum(1, 0) + 100);\n //id 1 + 100 = 101\n}\n</code>\n</div>"],"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":976,"description":"<p>Retrieves a String value from the Table&#39;s specified row and column.\nThe row is specified by its ID, while the column may be specified by\neither its ID or title.</p>\n","itemtype":"method","name":"getString","params":[{"name":"row","description":"<p>row ID</p>\n","type":"Number"},{"name":"column","description":"<p>columnName (string) or\n ID (number)</p>\n","type":"String|Number"}],"return":{"description":"","type":"String"},"example":["\n<div class=\"norender\">\n<code>\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nvar table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable(\"assets/mammals.csv\", \"csv\", \"header\");\n}\n\nfunction setup() {\n var tableArray = table.getArray();\n\n //output each row as array\n for (var i = 0; i < tableArray.length; i++)\n println(tableArray[i]);\n}\n</code>\n</div>"],"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":1020,"description":"<p>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.</p>\n","itemtype":"method","name":"getObject","params":[{"name":"headerColumn","description":"<p>Name of the column which should be used to\n title each row object (optional)</p>\n","type":"String"}],"return":{"description":"","type":"Object"},"example":["\n<div class=\"norender\">\n<code>\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nvar table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable(\"assets/mammals.csv\", \"csv\", \"header\");\n}\n\nfunction setup() {\n var tableObject = table.getObject();\n\n println(tableObject);\n //outputs an object\n}\n</code>\n</div>\n"],"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.Table.js","line":1081,"description":"<p>Retrieves all table data and returns it as a multidimensional array.</p>\n","itemtype":"method","name":"getArray","return":{"description":"","type":"Array"},"class":"p5.Table","module":"IO","submodule":"Table"},{"file":"src/io/p5.TableRow.js","line":42,"description":"<p>Stores a value in the TableRow&#39;s specified column.\nThe column may be specified by either its ID or title.</p>\n","itemtype":"method","name":"set","params":[{"name":"column","description":"<p>Column ID (Number)\n or Title (String)</p>\n","type":"String|Number"},{"name":"value","description":"<p>The value to be stored</p>\n","type":"String|Number"}],"class":"p5.TableRow","module":"IO","submodule":"Table"},{"file":"src/io/p5.TableRow.js","line":78,"description":"<p>Stores a Float value in the TableRow&#39;s specified column.\nThe column may be specified by either its ID or title.</p>\n","itemtype":"method","name":"setNum","params":[{"name":"column","description":"<p>Column ID (Number)\n or Title (String)</p>\n","type":"String|Number"},{"name":"value","description":"<p>The value to be stored\n as a Float</p>\n","type":"Number"}],"class":"p5.TableRow","module":"IO","submodule":"Table"},{"file":"src/io/p5.TableRow.js","line":94,"description":"<p>Stores a String value in the TableRow&#39;s specified column.\nThe column may be specified by either its ID or title.</p>\n","itemtype":"method","name":"setString","params":[{"name":"column","description":"<p>Column ID (Number)\n or Title (String)</p>\n","type":"String|Number"},{"name":"value","description":"<p>The value to be stored\n as a String</p>\n","type":"String"}],"class":"p5.TableRow","module":"IO","submodule":"Table"},{"file":"src/io/p5.TableRow.js","line":109,"description":"<p>Retrieves a value from the TableRow&#39;s specified column.\nThe column may be specified by either its ID or title.</p>\n","itemtype":"method","name":"get","params":[{"name":"column","description":"<p>columnName (string) or\n ID (number)</p>\n","type":"String|Number"}],"return":{"description":"","type":"String|Number"},"class":"p5.TableRow","module":"IO","submodule":"Table"},{"file":"src/io/p5.TableRow.js","line":126,"description":"<p>Retrieves a Float value from the TableRow&#39;s specified\ncolumn. The column may be specified by either its ID or\ntitle.</p>\n","itemtype":"method","name":"getNum","params":[{"name":"column","description":"<p>columnName (string) or\n ID (number)</p>\n","type":"String|Number"}],"return":{"description":"Float Floating point number","type":"Number"},"class":"p5.TableRow","module":"IO","submodule":"Table"},{"file":"src/io/p5.TableRow.js","line":150,"description":"<p>Retrieves an String value from the TableRow&#39;s specified\ncolumn. The column may be specified by either its ID or\ntitle.</p>\n","itemtype":"method","name":"getString","params":[{"name":"column","description":"<p>columnName (string) or\n ID (number)</p>\n","type":"String|Number"}],"return":{"description":"String","type":"String"},"class":"p5.TableRow","module":"IO","submodule":"Table"},{"file":"src/io/p5.XML.js","line":62,"description":"<p>Gets a copy of the element&#39;s parent. Returns the parent as another\np5.XML object.</p>\n","itemtype":"method","name":"getParent","return":{"description":"element parent","type":"Object"},"example":["\n<div class='norender'><code>\n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// <?xml version=\"1.0\"?>\n// &lt;mammals&gt;\n// &lt;animal id=\"0\" species=\"Capra hircus\">Goat&lt;/animal&gt;\n// &lt;animal id=\"1\" species=\"Panthera pardus\">Leopard&lt;/animal&gt;\n// &lt;animal id=\"2\" species=\"Equus zebra\">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nvar xml;\n\nfunction preload() {\n xml = loadXML(\"assets/mammals.xml\");\n}\n\nfunction setup() {\n var children = xml.getChildren(\"animal\");\n var parent = children[1].getParent();\n println(parent.getName());\n}\n\n// Sketch prints:\n// mammals\n</code></div>"],"class":"p5.XML","module":"IO","submodule":"XML"},{"file":"src/io/p5.XML.js","line":100,"description":"<p>Gets the element&#39;s full name, which is returned as a String.</p>\n","itemtype":"method","name":"getName","return":{"description":"the name of the node","type":"String"},"example":["&lt;animal\n <div class='norender'><code>\n // The following short XML file called \"mammals.xml\" is parsed\n // in the code below.\n //\n // <?xml version=\"1.0\"?>\n // &lt;mammals&gt;\n // &lt;animal id=\"0\" species=\"Capra hircus\">Goat&lt;/animal&gt;\n // &lt;animal id=\"1\" species=\"Panthera pardus\">Leopard&lt;/animal&gt;\n // &lt;animal id=\"2\" species=\"Equus zebra\">Zebra&lt;/animal&gt;\n // &lt;/mammals&gt;\n\n var xml;\n\n function preload() {\n xml = loadXML(\"assets/mammals.xml\");\n }\n\n function setup() {\n println(xml.getName());\n }\n\n // Sketch prints:\n // mammals\n </code></div>"],"class":"p5.XML","module":"IO","submodule":"XML"},{"file":"src/io/p5.XML.js","line":135,"description":"<p>Sets the element&#39;s name, which is specified as a String.</p>\n","itemtype":"method","name":"setName","params":[{"name":"the","description":"<p>new name of the node</p>\n","type":"String"}],"example":["&lt;animal\n<div class='norender'><code>\n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// <?xml version=\"1.0\"?>\n// &lt;mammals&gt;\n// &lt;animal id=\"0\" species=\"Capra hircus\">Goat&lt;/animal&gt;\n// &lt;animal id=\"1\" species=\"Panthera pardus\">Leopard&lt;/animal&gt;\n// &lt;animal id=\"2\" species=\"Equus zebra\">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nvar xml;\n\nfunction preload() {\n xml = loadXML(\"assets/mammals.xml\");\n}\n\nfunction setup() {\n println(xml.getName());\n xml.setName(\"fish\");\n println(xml.getName());\n}\n\n// Sketch prints:\n// mammals\n// fish\n</code></div>"],"class":"p5.XML","module":"IO","submodule":"XML"},{"file":"src/io/p5.XML.js","line":173,"description":"<p>Checks whether or not the element has any children, and returns the result\nas a boolean.</p>\n","itemtype":"method","name":"hasChildren","return":{"description":"","type":"Boolean"},"example":["&lt;animal\n<div class='norender'><code>\n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// <?xml version=\"1.0\"?>\n// &lt;mammals&gt;\n// &lt;animal id=\"0\" species=\"Capra hircus\">Goat&lt;/animal&gt;\n// &lt;animal id=\"1\" species=\"Panthera pardus\">Leopard&lt;/animal&gt;\n// &lt;animal id=\"2\" species=\"Equus zebra\">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nvar xml;\n\nfunction preload() {\n xml = loadXML(\"assets/mammals.xml\");\n}\n\nfunction setup() {\n println(xml.hasChildren());\n}\n\n// Sketch prints:\n// true\n</code></div>"],"class":"p5.XML","module":"IO","submodule":"XML"},{"file":"src/io/p5.XML.js","line":209,"description":"<p>Get the names of all of the element&#39;s children, and returns the names as an\narray of Strings. This is the same as looping through and calling getName()\non each child element individually.</p>\n","itemtype":"method","name":"listChildren","return":{"description":"names of the children of the element","type":"Array"},"example":["&lt;animal\n<div class='norender'><code>\n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// <?xml version=\"1.0\"?>\n// &lt;mammals&gt;\n// &lt;animal id=\"0\" species=\"Capra hircus\">Goat&lt;/animal&gt;\n// &lt;animal id=\"1\" species=\"Panthera pardus\">Leopard&lt;/animal&gt;\n// &lt;animal id=\"2\" species=\"Equus zebra\">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nvar xml;\n\nfunction preload() {\n xml = loadXML(\"assets/mammals.xml\");\n}\n\nfunction setup() {\n println(xml.listChildren());\n}\n\n// Sketch prints:\n// [\"animal\", \"animal\", \"animal\"]\n</code></div>"],"class":"p5.XML","module":"IO","submodule":"XML"},{"file":"src/io/p5.XML.js","line":246,"description":"<p>Returns all of the element&#39;s children as an array of p5.XML objects. When\nthe name parameter is specified, then it will return all children that match\nthat name.</p>\n","itemtype":"method","name":"getChildren","params":[{"name":"name","description":"<p>element name</p>\n","type":"String","optional":true}],"return":{"description":"children of the element","type":"Array"},"example":["&lt;animal\n<div class='norender'><code>\n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// <?xml version=\"1.0\"?>\n// &lt;mammals&gt;\n// &lt;animal id=\"0\" species=\"Capra hircus\">Goat&lt;/animal&gt;\n// &lt;animal id=\"1\" species=\"Panthera pardus\">Leopard&lt;/animal&gt;\n// &lt;animal id=\"2\" species=\"Equus zebra\">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nvar xml;\n\nfunction preload() {\n xml = loadXML(\"assets/mammals.xml\");\n}\n\nfunction setup() {\n var animals = xml.getChildren(\"animal\");\n\n for (var i = 0; i < animals.length; i++) {\n println(animals[i].getContent());\n }\n}\n\n// Sketch prints:\n// \"Goat\"\n// \"Leopard\"\n// \"Zebra\"\n</code></div>"],"class":"p5.XML","module":"IO","submodule":"XML"},{"file":"src/io/p5.XML.js","line":295,"description":"<p>Returns the first of the element&#39;s children that matches the name parameter\nor the child of the given index.It returns undefined if no matching\nchild is found.</p>\n","itemtype":"method","name":"getChild","params":[{"name":"name","description":"<p>element name or index</p>\n","type":"String|Number"}],"return":{"description":"","type":"p5.XML"},"example":["&lt;animal\n<div class='norender'><code>\n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// <?xml version=\"1.0\"?>\n// &lt;mammals&gt;\n// &lt;animal id=\"0\" species=\"Capra hircus\">Goat&lt;/animal&gt;\n// &lt;animal id=\"1\" species=\"Panthera pardus\">Leopard&lt;/animal&gt;\n// &lt;animal id=\"2\" species=\"Equus zebra\">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nvar xml;\n\nfunction preload() {\n xml = loadXML(\"assets/mammals.xml\");\n}\n\nfunction setup() {\n var firstChild = xml.getChild(\"animal\");\n println(firstChild.getContent());\n}\n\n// Sketch prints:\n// \"Goat\"\n</code></div>\n<div class='norender'><code>\nvar xml;\n\nfunction preload() {\n xml = loadXML(\"assets/mammals.xml\");\n}\n\nfunction setup() {\n var secondChild = xml.getChild(1);\n println(secondChild.getContent());\n}\n\n// Sketch prints:\n// \"Leopard\"\n</code></div>"],"class":"p5.XML","module":"IO","submodule":"XML"},{"file":"src/io/p5.XML.js","line":356,"description":"<p>Appends a new child to the element. The child can be specified with\neither a String, which will be used as the new tag&#39;s name, or as a\nreference to an existing p5.XML object.\nA reference to the newly created child is returned as an p5.XML object.</p>\n","itemtype":"method","name":"addChild","params":[{"name":"a","description":"<p>p5.XML Object which will be the child to be added</p>\n","type":"Object"}],"class":"p5.XML","module":"IO","submodule":"XML"},{"file":"src/io/p5.XML.js","line":373,"description":"<p>Removes the element specified by name or index.</p>\n","itemtype":"method","name":"removeChild","params":[{"name":"name","description":"<p>element name or index</p>\n","type":"String|Number"}],"example":["\n<div class='norender'><code>\n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// <?xml version=\"1.0\"?>\n// &lt;mammals&gt;\n// &lt;animal id=\"0\" species=\"Capra hircus\">Goat&lt;/animal&gt;\n// &lt;animal id=\"1\" species=\"Panthera pardus\">Leopard&lt;/animal&gt;\n// &lt;animal id=\"2\" species=\"Equus zebra\">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nvar xml;\n\nfunction preload() {\n xml = loadXML(\"assets/mammals.xml\");\n}\n\nfunction setup() {\n xml.removeChild(\"animal\");\n var children = xml.getChildren();\n for (var i=0; i<children.length; i++) {\n println(children[i].getContent());\n }\n}\n\n// Sketch prints:\n// \"Leopard\"\n// \"Zebra\"\n</code></div>\n<div class='norender'><code>\nvar xml;\n\nfunction preload() {\n xml = loadXML(\"assets/mammals.xml\");\n}\n\nfunction setup() {\n xml.removeChild(1);\n var children = xml.getChildren();\n for (var i=0; i<children.length; i++) {\n println(children[i].getContent());\n }\n}\n\n// Sketch prints:\n// \"Goat\"\n// \"Zebra\"\n</code></div>"],"class":"p5.XML","module":"IO","submodule":"XML"},{"file":"src/io/p5.XML.js","line":446,"description":"<p>Counts the specified element&#39;s number of attributes, returned as an Number.</p>\n","itemtype":"method","name":"getAttributeCount","return":{"description":"","type":"Number"},"example":["\n<div class='norender'><code>\n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// <?xml version=\"1.0\"?>\n// &lt;mammals&gt;\n// &lt;animal id=\"0\" species=\"Capra hircus\">Goat&lt;/animal&gt;\n// &lt;animal id=\"1\" species=\"Panthera pardus\">Leopard&lt;/animal&gt;\n// &lt;animal id=\"2\" species=\"Equus zebra\">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nvar xml;\n\nfunction preload() {\n xml = loadXML(\"assets/mammals.xml\");\n}\n\nfunction setup() {\n var firstChild = xml.getChild(\"animal\");\n println(firstChild.getAttributeCount());\n}\n\n// Sketch prints:\n// 2\n</code></div>"],"class":"p5.XML","module":"IO","submodule":"XML"},{"file":"src/io/p5.XML.js","line":482,"description":"<p>Gets all of the specified element&#39;s attributes, and returns them as an\narray of Strings.</p>\n","itemtype":"method","name":"listAttributes","return":{"description":"an array of strings containing the names of attributes","type":"Array"},"example":["\n<div class='norender'><code>\n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// <?xml version=\"1.0\"?>\n// &lt;mammals&gt;\n// &lt;animal id=\"0\" species=\"Capra hircus\">Goat&lt;/animal&gt;\n// &lt;animal id=\"1\" species=\"Panthera pardus\">Leopard&lt;/animal&gt;\n// &lt;animal id=\"2\" species=\"Equus zebra\">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nvar xml;\n\nfunction preload() {\n xml = loadXML(\"assets/mammals.xml\");\n}\n\nfunction setup() {\n var firstChild = xml.getChild(\"animal\");\n println(firstChild.listAttributes());\n}\n\n// Sketch prints:\n// [\"id\", \"species\"]\n</code></div>"],"class":"p5.XML","module":"IO","submodule":"XML"},{"file":"src/io/p5.XML.js","line":519,"description":"<p>Checks whether or not an element has the specified attribute.</p>\n","itemtype":"method","name":"hasAttribute","params":[{"name":"the","description":"<p>attribute to be checked</p>\n","type":"String"}],"return":{"description":"true if attribute found else false","type":"Boolean"},"example":["\n <div class='norender'><code>\n // The following short XML file called \"mammals.xml\" is parsed\n // in the code below.\n //\n // <?xml version=\"1.0\"?>\n // &lt;mammals&gt;\n // &lt;animal id=\"0\" species=\"Capra hircus\">Goat&lt;/animal&gt;\n // &lt;animal id=\"1\" species=\"Panthera pardus\">Leopard&lt;/animal&gt;\n // &lt;animal id=\"2\" species=\"Equus zebra\">Zebra&lt;/animal&gt;\n // &lt;/mammals&gt;\n\n var xml;\n\n function preload() {\n xml = loadXML(\"assets/mammals.xml\");\n }\n\n function setup() {\n var firstChild = xml.getChild(\"animal\");\n println(firstChild.hasAttribute(\"species\"));\n println(firstChild.hasAttribute(\"color\"));\n }\n\n // Sketch prints:\n // true\n // false\n </code></div>"],"class":"p5.XML","module":"IO","submodule":"XML"},{"file":"src/io/p5.XML.js","line":558,"description":"<p>Returns an attribute value of the element as an Number. If the defaultValue\nparameter is specified and the attribute doesn&#39;t exist, then defaultValue\nis returned. If no defaultValue is specified and the attribute doesn&#39;t\nexist, the value 0 is returned.</p>\n","itemtype":"method","name":"getNumber","params":[{"name":"name","description":"<p>the non-null full name of the attribute</p>\n","type":"String"},{"name":"defaultValue","description":"<p>the default value of the attribute</p>\n","type":"Number","optional":true}],"return":{"description":"","type":"Number"},"example":["\n<div class='norender'><code>\n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// <?xml version=\"1.0\"?>\n// &lt;mammals&gt;\n// &lt;animal id=\"0\" species=\"Capra hircus\">Goat&lt;/animal&gt;\n// &lt;animal id=\"1\" species=\"Panthera pardus\">Leopard&lt;/animal&gt;\n// &lt;animal id=\"2\" species=\"Equus zebra\">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nvar xml;\n\nfunction preload() {\n xml = loadXML(\"assets/mammals.xml\");\n}\n\nfunction setup() {\n var firstChild = xml.getChild(\"animal\");\n println(firstChild.getNumber(\"id\"));\n}\n\n// Sketch prints:\n// 0\n</code></div>"],"class":"p5.XML","module":"IO","submodule":"XML"},{"file":"src/io/p5.XML.js","line":599,"description":"<p>Returns an attribute value of the element as an String. If the defaultValue\nparameter is specified and the attribute doesn&#39;t exist, then defaultValue\nis returned. If no defaultValue is specified and the attribute doesn&#39;t\nexist, null is returned.</p>\n","itemtype":"method","name":"getString","params":[{"name":"name","description":"<p>the non-null full name of the attribute</p>\n","type":"String"},{"name":"defaultValue","description":"<p>the default value of the attribute</p>\n","type":"Number","optional":true}],"return":{"description":"","type":"Number"},"example":["\n<div class='norender'><code>\n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// <?xml version=\"1.0\"?>\n// &lt;mammals&gt;\n// &lt;animal id=\"0\" species=\"Capra hircus\">Goat&lt;/animal&gt;\n// &lt;animal id=\"1\" species=\"Panthera pardus\">Leopard&lt;/animal&gt;\n// &lt;animal id=\"2\" species=\"Equus zebra\">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nvar xml;\n\nfunction preload() {\n xml = loadXML(\"assets/mammals.xml\");\n}\n\nfunction setup() {\n var firstChild = xml.getChild(\"animal\");\n println(firstChild.getString(\"species\"));\n}\n\n// Sketch prints:\n// \"Capra hircus\"\n</code></div>"],"class":"p5.XML","module":"IO","submodule":"XML"},{"file":"src/io/p5.XML.js","line":640,"description":"<p>Sets the content of an element&#39;s attribute. The first parameter specifies\nthe attribute name, while the second specifies the new content.</p>\n","itemtype":"method","name":"setAttribute","params":[{"name":"name","description":"<p>the full name of the attribute</p>\n","type":"String"},{"name":"value","description":"<p>the value of the attribute</p>\n","type":"Number"}],"example":["\n<div class='norender'><code>\n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// <?xml version=\"1.0\"?>\n// &lt;mammals&gt;\n// &lt;animal id=\"0\" species=\"Capra hircus\">Goat&lt;/animal&gt;\n// &lt;animal id=\"1\" species=\"Panthera pardus\">Leopard&lt;/animal&gt;\n// &lt;animal id=\"2\" species=\"Equus zebra\">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nvar xml;\n\nfunction preload() {\n xml = loadXML(\"assets/mammals.xml\");\n}\n\nfunction setup() {\n var firstChild = xml.getChild(\"animal\");\n println(firstChild.getString(\"species\"));\n firstChild.setAttribute(\"species\", \"Jamides zebra\");\n println(firstChild.getString(\"species\"));\n}\n\n// Sketch prints:\n// \"Capra hircus\"\n// \"Jamides zebra\"\n</code></div>"],"class":"p5.XML","module":"IO","submodule":"XML"},{"file":"src/io/p5.XML.js","line":683,"description":"<p>Returns the content of an element. If there is no such content,\ndefaultValue is returned if specified, otherwise null is returned.</p>\n","itemtype":"method","name":"getContent","params":[{"name":"defaultValue","description":"<p>value returned if no content is found</p>\n","type":"String","optional":true}],"return":{"description":"","type":"String"},"example":["\n<div class='norender'><code>\n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// <?xml version=\"1.0\"?>\n// &lt;mammals&gt;\n// &lt;animal id=\"0\" species=\"Capra hircus\">Goat&lt;/animal&gt;\n// &lt;animal id=\"1\" species=\"Panthera pardus\">Leopard&lt;/animal&gt;\n// &lt;animal id=\"2\" species=\"Equus zebra\">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nvar xml;\n\nfunction preload() {\n xml = loadXML(\"assets/mammals.xml\");\n}\n\nfunction setup() {\n var firstChild = xml.getChild(\"animal\");\n println(firstChild.getContent());\n}\n\n// Sketch prints:\n// \"Goat\"\n</code></div>"],"class":"p5.XML","module":"IO","submodule":"XML"},{"file":"src/io/p5.XML.js","line":721,"description":"<p>Sets the element&#39;s content.</p>\n","itemtype":"method","name":"setContent","params":[{"name":"text","description":"<p>the new content</p>\n","type":"String"}],"example":["\n<div class='norender'><code>\n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// <?xml version=\"1.0\"?>\n// &lt;mammals&gt;\n// &lt;animal id=\"0\" species=\"Capra hircus\">Goat&lt;/animal&gt;\n// &lt;animal id=\"1\" species=\"Panthera pardus\">Leopard&lt;/animal&gt;\n// &lt;animal id=\"2\" species=\"Equus zebra\">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nvar xml;\n\nfunction preload() {\n xml = loadXML(\"assets/mammals.xml\");\n}\n\nfunction setup() {\n var firstChild = xml.getChild(\"animal\");\n println(firstChild.getContent());\n firstChild.setContent(\"Mountain Goat\");\n println(firstChild.getContent());\n}\n\n// Sketch prints:\n// \"Goat\"\n// \"Mountain Goat\"\n</code></div>"],"class":"p5.XML","module":"IO","submodule":"XML"},{"file":"src/io/p5.XML.js","line":763,"description":"<p>This method is called while the parsing of XML (when loadXML() is\ncalled). The difference between this method and the setContent()\nmethod defined later is that this one is used to set the content\nwhen the node in question has more nodes under it and so on and\nnot directly text content. While in the other one is used when\nthe node in question directly has text inside it.</p>\n","class":"p5.XML","module":"IO","submodule":"XML"},{"file":"src/io/p5.XML.js","line":780,"description":"<p>This method is called while the parsing of XML (when loadXML() is\ncalled). The XML node is passed and its attributes are stored in the\np5.XML&#39;s attribute Object.</p>\n","class":"p5.XML","module":"IO","submodule":"XML"},{"file":"src/math/calculation.js","line":12,"description":"<p>Calculates the absolute value (magnitude) of a number. Maps to Math.abs().\nThe absolute value of a number is always positive.</p>\n","itemtype":"method","name":"abs","params":[{"name":"n","description":"<p>number to compute</p>\n","type":"Number"}],"return":{"description":"absolute value of given number","type":"Number"},"example":["\n<div class = \"norender\"><code>\nfunction setup() {\n var x = -3;\n var y = abs(x);\n\n println(x); // -3\n println(y); // 3\n}\n</code></div>"],"class":"p5","module":"Math","submodule":"Calculation"},{"file":"src/math/calculation.js","line":32,"description":"<p>Calculates the closest int value that is greater than or equal to the\nvalue of the parameter. Maps to Math.ceil(). For example, ceil(9.03)\nreturns the value 10.</p>\n","itemtype":"method","name":"ceil","params":[{"name":"n","description":"<p>number to round up</p>\n","type":"Number"}],"return":{"description":"rounded up number","type":"Number"},"example":["\n<div><code>\nfunction draw() {\n background(200);\n // map, mouseX between 0 and 5.\n var ax = map(mouseX, 0, 100, 0, 5);\n var ay = 66;\n\n //Get the ceiling of the mapped number.\n var bx = ceil(map(mouseX, 0, 100, 0,5));\n var by = 33;\n\n // Multiply the mapped numbers by 20 to more easily\n // see the changes.\n stroke(0);\n fill(0);\n line(0, ay, ax * 20, ay);\n line(0, by, bx * 20, by);\n\n // Reformat the float returned by map and draw it.\n noStroke();\n text(nfc(ax, 2,2), ax, ay - 5);\n text(nfc(bx,1,1), bx, by - 5);\n}\n</code></div>"],"class":"p5","module":"Math","submodule":"Calculation"},{"file":"src/math/calculation.js","line":68,"description":"<p>Constrains a value between a minimum and maximum value.</p>\n","itemtype":"method","name":"constrain","params":[{"name":"n","description":"<p>number to constrain</p>\n","type":"Number"},{"name":"low","description":"<p>minimum limit</p>\n","type":"Number"},{"name":"high","description":"<p>maximum limit</p>\n","type":"Number"}],"return":{"description":"constrained number","type":"Number"},"example":["\n<div><code>\nfunction draw() {\n background(200);\n\n var leftWall = 25;\n var rightWall = 75;\n\n // xm is just the mouseX, while\n // xc is the mouseX, but constrained\n // between the leftWall and rightWall!\n var xm = mouseX;\n var xc = constrain(mouseX, leftWall, rightWall);\n\n // Draw the walls.\n stroke(150);\n line(leftWall, 0, leftWall, height);\n line(rightWall, 0, rightWall, height);\n\n // Draw xm and xc as circles.\n noStroke();\n fill(150);\n ellipse(xm, 33, 9,9); // Not Constrained\n fill(0);\n ellipse(xc, 66, 9,9); // Constrained\n}\n</code></div>"],"class":"p5","module":"Math","submodule":"Calculation"},{"file":"src/math/calculation.js","line":108,"description":"<p>Calculates the distance between two points.</p>\n","itemtype":"method","name":"dist","params":[{"name":"x1","description":"<p>x-coordinate of the first point</p>\n","type":"Number"},{"name":"y1","description":"<p>y-coordinate of the first point</p>\n","type":"Number"},{"name":"z1","description":"<p>z-coordinate of the first point</p>\n","type":"Number","optional":true},{"name":"x2","description":"<p>x-coordinate of the second point</p>\n","type":"Number"},{"name":"y2","description":"<p>y-coordinate of the second point</p>\n","type":"Number"},{"name":"z2","description":"<p>z-coordinate of the second point</p>\n","type":"Number","optional":true}],"return":{"description":"distance between the two points","type":"Number"},"example":["\n<div><code>\n// Move your mouse inside the canvas to see the\n// change in distance between two points!\nfunction draw() {\n background(200);\n fill(0);\n\n var x1 = 10;\n var y1 = 90;\n var x2 = mouseX;\n var y2 = mouseY;\n\n line(x1, y1, x2, y2);\n ellipse(x1, y1, 7, 7);\n ellipse(x2, y2, 7, 7);\n\n // d is the length of the line\n // the distance from point 1 to point 2.\n var d = int(dist(x1, y1, x2, y2));\n\n // Let's write d along the line we are drawing!\n push();\n translate( (x1+x2)/2, (y1+y2)/2 );\n rotate( atan2(y2-y1,x2-x1) );\n text(nfc(d,1,1), 0, -5);\n pop();\n // Fancy!\n}\n</code></div>"],"class":"p5","module":"Math","submodule":"Calculation"},{"file":"src/math/calculation.js","line":159,"description":"<p>Returns Euler&#39;s number e (2.71828...) raised to the power of the n\nparameter. Maps to Math.exp().</p>\n","itemtype":"method","name":"exp","params":[{"name":"n","description":"<p>exponent to raise</p>\n","type":"Number"}],"return":{"description":"e^n","type":"Number"},"example":["\n<div><code>\nfunction draw() {\n background(200);\n\n // Compute the exp() function with a value between 0 and 2\n var xValue = map(mouseX, 0, width, 0, 2);\n var yValue = exp(xValue);\n\n var y = map(yValue, 0, 8, height, 0);\n\n var legend = \"exp (\" + nfc(xValue, 3) +\")\\n= \" + nf(yValue, 1, 4);\n stroke(150);\n line(mouseX, y, mouseX, height);\n fill(0);\n text(legend, 5, 15);\n noStroke();\n ellipse (mouseX,y, 7, 7);\n\n // Draw the exp(x) curve,\n // over the domain of x from 0 to 2\n noFill();\n stroke(0);\n beginShape();\n for (var x = 0; x < width; x++) {\n xValue = map(x, 0, width, 0, 2);\n yValue = exp(xValue);\n y = map(yValue, 0, 8, height, 0);\n vertex(x, y);\n }\n\n endShape();\n line(0, 0, 0, height);\n line(0, height-1, width, height-1);\n}\n</code></div>"],"class":"p5","module":"Math","submodule":"Calculation"},{"file":"src/math/calculation.js","line":205,"description":"<p>Calculates the closest int value that is less than or equal to the\nvalue of the parameter. Maps to Math.floor().</p>\n","itemtype":"method","name":"floor","params":[{"name":"n","description":"<p>number to round down</p>\n","type":"Number"}],"return":{"description":"rounded down number","type":"Number"},"example":["\n<div><code>\nfunction draw() {\n background(200);\n //map, mouseX between 0 and 5.\n var ax = map(mouseX, 0, 100, 0, 5);\n var ay = 66;\n\n //Get the floor of the mapped number.\n var bx = floor(map(mouseX, 0, 100, 0,5));\n var by = 33;\n\n // Multiply the mapped numbers by 20 to more easily\n // see the changes.\n stroke(0);\n fill(0);\n line(0, ay, ax * 20, ay);\n line(0, by, bx * 20, by);\n\n // Reformat the float returned by map and draw it.\n noStroke();\n text(nfc(ax, 2,2), ax, ay - 5);\n text(nfc(bx,1,1), bx, by - 5);\n}\n</code></div>"],"class":"p5","module":"Math","submodule":"Calculation"},{"file":"src/math/calculation.js","line":240,"description":"<p>Calculates a number between two numbers at a specific increment. The amt\nparameter is the amount to interpolate between the two values where 0.0\nequal to the first point, 0.1 is very near the first point, 0.5 is\nhalf-way in between, etc. The lerp function is convenient for creating\nmotion along a straight path and for drawing dotted lines.</p>\n","itemtype":"method","name":"lerp","params":[{"name":"start","description":"<p>first value</p>\n","type":"Number"},{"name":"stop","description":"<p>second value</p>\n","type":"Number"},{"name":"amt","description":"<p>number between 0.0 and 1.0</p>\n","type":"Number"}],"return":{"description":"lerped value","type":"Number"},"example":["\n<div><code>\nfunction setup() {\n background(200);\n var a = 20;\n var b = 80;\n var c = lerp(a,b, .2);\n var d = lerp(a,b, .5);\n var e = lerp(a,b, .8);\n\n var y = 50\n\n strokeWeight(5);\n stroke(0); // Draw the original points in black\n point(a, y);\n point(b, y);\n\n stroke(100); // Draw the lerp points in gray\n point(c, y);\n point(d, y);\n point(e, y);\n}\n</code></div>"],"class":"p5","module":"Math","submodule":"Calculation"},{"file":"src/math/calculation.js","line":280,"description":"<p>Calculates the natural logarithm (the base-e logarithm) of a number. This\nfunction expects the n parameter to be a value greater than 0.0. Maps to\nMath.log().</p>\n","itemtype":"method","name":"log","params":[{"name":"n","description":"<p>number greater than 0</p>\n","type":"Number"}],"return":{"description":"natural logarithm of n","type":"Number"},"example":["\n<div><code>\nfunction draw() {\n background(200);\n var maxX = 2.8;\n var maxY = 1.5;\n\n // Compute the natural log of a value between 0 and maxX\n var xValue = map(mouseX, 0, width, 0, maxX);\n if (xValue > 0) { // Cannot take the log of a negative number.\n var yValue = log(xValue);\n var y = map(yValue, -maxY, maxY, height, 0);\n\n // Display the calculation occurring.\n var legend = \"log(\" + nf(xValue, 1, 2) + \")\\n= \" + nf(yValue, 1, 3);\n stroke(150);\n line(mouseX, y, mouseX, height);\n fill(0);\n text (legend, 5, 15);\n noStroke();\n ellipse (mouseX, y, 7, 7);\n }\n\n // Draw the log(x) curve,\n // over the domain of x from 0 to maxX\n noFill();\n stroke(0);\n beginShape();\n for(var x=0; x < width; x++) {\n xValue = map(x, 0, width, 0, maxX);\n yValue = log(xValue);\n y = map(yValue, -maxY, maxY, height, 0);\n vertex(x, y);\n }\n endShape();\n line(0,0,0,height);\n line(0,height/2,width, height/2);\n}\n</code></div>"],"class":"p5","module":"Math","submodule":"Calculation"},{"file":"src/math/calculation.js","line":330,"description":"<p>Calculates the magnitude (or length) of a vector. A vector is a direction\nin space commonly used in computer graphics and linear algebra. Because it\nhas no &quot;start&quot; position, the magnitude of a vector can be thought of as\nthe distance from the coordinate 0,0 to its x,y value. Therefore, mag() is\na shortcut for writing dist(0, 0, x, y).</p>\n","itemtype":"method","name":"mag","params":[{"name":"a","description":"<p>first value</p>\n","type":"Number"},{"name":"b","description":"<p>second value</p>\n","type":"Number"}],"return":{"description":"magnitude of vector from (0,0) to (a,b)","type":"Number"},"example":["\n<div><code>\nfunction setup() {\n var x1 = 20;\n var x2 = 80;\n var y1 = 30;\n var y2 = 70;\n\n line(0, 0, x1, y1);\n println(mag(x1, y1)); // Prints \"36.05551\"\n line(0, 0, x2, y1);\n println(mag(x2, y1)); // Prints \"85.44004\"\n line(0, 0, x1, y2);\n println(mag(x1, y2)); // Prints \"72.8011\"\n line(0, 0, x2, y2);\n println(mag(x2, y2)); // Prints \"106.30146\"\n}\n</code></div>"],"class":"p5","module":"Math","submodule":"Calculation"},{"file":"src/math/calculation.js","line":364,"description":"<p>Re-maps a number from one range to another.\n<br><br>\nIn the first example above, the number 25 is converted from a value in the\nrange of 0 to 100 into a value that ranges from the left edge of the\nwindow (0) to the right edge (width).</p>\n","itemtype":"method","name":"map","params":[{"name":"value","description":"<p>the incoming value to be converted</p>\n","type":"Number"},{"name":"start1","description":"<p>lower bound of the value&#39;s current range</p>\n","type":"Number"},{"name":"stop1","description":"<p>upper bound of the value&#39;s current range</p>\n","type":"Number"},{"name":"start2","description":"<p>lower bound of the value&#39;s target range</p>\n","type":"Number"},{"name":"stop2","description":"<p>upper bound of the value&#39;s target range</p>\n","type":"Number"}],"return":{"description":"remapped number","type":"Number"},"example":["\n <div><code>\n var value = 25;\n var m = map(value, 0, 100, 0, width);\n ellipse(m, 50, 10, 10);\n </code></div>\n\n <div><code>\n function setup() {\n noStroke();\n }\n\n function draw() {\n background(204);\n var x1 = map(mouseX, 0, width, 25, 75);\n ellipse(x1, 25, 25, 25);\n var x2 = map(mouseX, 0, width, 0, 100);\n ellipse(x2, 75, 25, 25);\n }\n </code></div>"],"class":"p5","module":"Math","submodule":"Calculation"},{"file":"src/math/calculation.js","line":403,"description":"<p>Determines the largest value in a sequence of numbers, and then returns\nthat value. max() accepts any number of Number parameters, or an Array\nof any length.</p>\n","itemtype":"method","name":"max","params":[{"name":"n0","description":"<p>Numbers to compare</p>\n","type":"Number|Array"}],"return":{"description":"maximum Number","type":"Number"},"example":["\n<div><code>\nfunction setup() {\n // Change the elements in the array and run the sketch\n // to show how max() works!\n numArray = new Array(2,1,5,4,8,9);\n fill(0);\n noStroke();\n text(\"Array Elements\", 0, 10);\n // Draw all numbers in the array\n var spacing = 15;\n var elemsY = 25;\n for(var i = 0; i < numArray.length; i++) {\n text(numArray[i], i * spacing, elemsY);\n }\n maxX = 33;\n maxY = 80;\n // Draw the Maximum value in the array.\n textSize(32);\n text(max(numArray), maxX, maxY);\n}\n</code></div>"],"class":"p5","module":"Math","submodule":"Calculation"},{"file":"src/math/calculation.js","line":442,"description":"<p>Determines the smallest value in a sequence of numbers, and then returns\nthat value. min() accepts any number of Number parameters, or an Array\nof any length.</p>\n","itemtype":"method","name":"min","params":[{"name":"n0","description":"<p>Numbers to compare</p>\n","type":"Number|Array"}],"return":{"description":"minimum Number","type":"Number"},"example":["\n<div><code>\nfunction setup() {\n // Change the elements in the array and run the sketch\n // to show how min() works!\n numArray = new Array(2,1,5,4,8,9);\n fill(0);\n noStroke();\n text(\"Array Elements\", 0, 10);\n // Draw all numbers in the array\n var spacing = 15;\n var elemsY = 25;\n for(var i = 0; i < numArray.length; i++) {\n text(numArray[i], i * spacing, elemsY);\n }\n maxX = 33;\n maxY = 80;\n // Draw the Minimum value in the array.\n textSize(32);\n text(min(numArray), maxX, maxY);\n}\n</code></div>"],"class":"p5","module":"Math","submodule":"Calculation"},{"file":"src/math/calculation.js","line":481,"description":"<p>Normalizes a number from another range into a value between 0 and 1.\nIdentical to map(value, low, high, 0, 1).\nNumbers outside of the range are not clamped to 0 and 1, because\nout-of-range values are often intentional and useful. (See the second\nexample above.)</p>\n","itemtype":"method","name":"norm","params":[{"name":"value","description":"<p>incoming value to be normalized</p>\n","type":"Number"},{"name":"start","description":"<p>lower bound of the value&#39;s current range</p>\n","type":"Number"},{"name":"stop","description":"<p>upper bound of the value&#39;s current range</p>\n","type":"Number"}],"return":{"description":"normalized number","type":"Number"},"example":["\n<div><code>\nfunction draw() {\n background(200);\n currentNum = mouseX;\n lowerBound = 0;\n upperBound = width; //100;\n normalized = norm(currentNum, lowerBound, upperBound);\n lineY = 70\n line(0, lineY, width, lineY);\n //Draw an ellipse mapped to the non-normalized value.\n noStroke();\n fill(50)\n var s = 7; // ellipse size\n ellipse(currentNum, lineY, s, s);\n\n // Draw the guide\n guideY = lineY + 15;\n text(\"0\", 0, guideY);\n textAlign(RIGHT);\n text(\"100\", width, guideY);\n\n // Draw the normalized value\n textAlign(LEFT);\n fill(0);\n textSize(32);\n normalY = 40;\n normalX = 20;\n text(normalized, normalX, normalY);\n}\n</code></div>"],"class":"p5","module":"Math","submodule":"Calculation"},{"file":"src/math/calculation.js","line":529,"description":"<p>Facilitates exponential expressions. The pow() function is an efficient\nway of multiplying numbers by themselves (or their reciprocals) in large\nquantities. For example, pow(3, 5) is equivalent to the expression\n3<em>3</em>3<em>3</em>3 and pow(3, -5) is equivalent to 1 / 3<em>3</em>3<em>3</em>3. Maps to\nMath.pow().</p>\n","itemtype":"method","name":"pow","params":[{"name":"n","description":"<p>base of the exponential expression</p>\n","type":"Number"},{"name":"e","description":"<p>power by which to raise the base</p>\n","type":"Number"}],"return":{"description":"n^e","type":"Number"},"example":["\n<div><code>\nfunction setup() {\n //Exponentially increase the size of an ellipse.\n eSize = 3; // Original Size\n eLoc = 10; // Original Location\n\n ellipse(eLoc, eLoc, eSize, eSize);\n\n ellipse(eLoc*2, eLoc*2, pow(eSize, 2), pow(eSize, 2));\n\n ellipse(eLoc*4, eLoc*4, pow(eSize, 3), pow(eSize, 3));\n\n ellipse(eLoc*8, eLoc*8, pow(eSize, 4), pow(eSize, 4));\n}\n</code></div>"],"class":"p5","module":"Math","submodule":"Calculation"},{"file":"src/math/calculation.js","line":559,"description":"<p>Calculates the integer closest to the n parameter. For example,\nround(133.8) returns the value 134. Maps to Math.round().</p>\n","itemtype":"method","name":"round","params":[{"name":"n","description":"<p>number to round</p>\n","type":"Number"}],"return":{"description":"rounded number","type":"Number"},"example":["\n<div><code>\nfunction draw() {\n background(200);\n //map, mouseX between 0 and 5.\n var ax = map(mouseX, 0, 100, 0, 5);\n var ay = 66;\n\n // Round the mapped number.\n var bx = round(map(mouseX, 0, 100, 0,5));\n var by = 33;\n\n // Multiply the mapped numbers by 20 to more easily\n // see the changes.\n stroke(0);\n fill(0);\n line(0, ay, ax * 20, ay);\n line(0, by, bx * 20, by);\n\n // Reformat the float returned by map and draw it.\n noStroke();\n text(nfc(ax, 2,2), ax, ay - 5);\n text(nfc(bx,1,1), bx, by - 5);\n}\n</code></div>"],"class":"p5","module":"Math","submodule":"Calculation"},{"file":"src/math/calculation.js","line":594,"description":"<p>Squares a number (multiplies a number by itself). The result is always a\npositive number, as multiplying two negative numbers always yields a\npositive result. For example, -1 * -1 = 1.</p>\n","itemtype":"method","name":"sq","params":[{"name":"n","description":"<p>number to square</p>\n","type":"Number"}],"return":{"description":"squared number","type":"Number"},"example":["\n<div><code>\nfunction draw() {\n background(200);\n eSize = 7;\n x1 = map(mouseX, 0, width, 0, 10);\n y1 = 80;\n x2 = sq(x1);\n y2 = 20;\n\n // Draw the non-squared.\n line(0, y1, width, y1);\n ellipse(x1, y1, eSize, eSize);\n\n // Draw the squared.\n line(0, y2, width, y2);\n ellipse(x2, y2, eSize, eSize);\n\n // Draw dividing line.\n stroke(100)\n line(0, height/2, width, height/2);\n\n // Draw text.\n var spacing = 15;\n noStroke();\n fill(0);\n text(\"x = \" + x1, 0, y1 + spacing);\n text(\"sq(x) = \" + x2, 0, y2 + spacing);\n}\n</code></div>"],"class":"p5","module":"Math","submodule":"Calculation"},{"file":"src/math/calculation.js","line":635,"description":"<p>Calculates the square root of a number. The square root of a number is\nalways positive, even though there may be a valid negative root. The\nsquare root s of number a is such that s*s = a. It is the opposite of\nsquaring. Maps to Math.sqrt().</p>\n","itemtype":"method","name":"sqrt","params":[{"name":"n","description":"<p>non-negative number to square root</p>\n","type":"Number"}],"return":{"description":"square root of number","type":"Number"},"example":["\n<div><code>\nfunction draw() {\n background(200);\n eSize = 7;\n x1 = mouseX;\n y1 = 80;\n x2 = sqrt(x1);\n y2 = 20;\n\n // Draw the non-squared.\n line(0, y1, width, y1);\n ellipse(x1, y1, eSize, eSize);\n\n // Draw the squared.\n line(0, y2, width, y2);\n ellipse(x2, y2, eSize, eSize);\n\n // Draw dividing line.\n stroke(100)\n line(0, height/2, width, height/2);\n\n // Draw text.\n noStroke();\n fill(0);\n var spacing = 15;\n text(\"x = \" + x1, 0, y1 + spacing);\n text(\"sqrt(x) = \" + x2, 0, y2 + spacing);\n}\n</code></div>"],"class":"p5","module":"Math","submodule":"Calculation"},{"file":"src/math/math.js","line":13,"description":"<p>Creates a new p5.Vector (the datatype for storing vectors). This provides a\ntwo or three dimensional vector, specifically a Euclidean (also known as\ngeometric) vector. A vector is an entity that has both magnitude and\ndirection.</p>\n","itemtype":"method","name":"createVector","params":[{"name":"x","description":"<p>x component of the vector</p>\n","type":"Number","optional":true},{"name":"y","description":"<p>y component of the vector</p>\n","type":"Number","optional":true},{"name":"z","description":"<p>z component of the vector</p>\n","type":"Number","optional":true}],"class":"p5","module":"Math","submodule":"Math"},{"file":"src/math/noise.js","line":41,"description":"<p>Returns the Perlin noise value at specified coordinates. Perlin noise is\na random sequence generator producing a more natural ordered, harmonic\nsuccession of numbers compared to the standard <b>random()</b> function.\nIt was invented by Ken Perlin in the 1980s and been used since in\ngraphical applications to produce procedural textures, natural motion,\nshapes, terrains etc.<br /><br /> The main difference to the\n<b>random()</b> function is that Perlin noise is defined in an infinite\nn-dimensional space where each pair of coordinates corresponds to a\nfixed semi-random value (fixed only for the lifespan of the program; see\nthe noiseSeed() function). p5.js can compute 1D, 2D and 3D noise,\ndepending on the number of coordinates given. The resulting value will\nalways be between 0.0 and 1.0. The noise value can be animated by moving\nthrough the noise space as demonstrated in the example above. The 2nd\nand 3rd dimension can also be interpreted as time.<br /><br />The actual\nnoise is structured similar to an audio signal, in respect to the\nfunction&#39;s use of frequencies. Similar to the concept of harmonics in\nphysics, perlin noise is computed over several octaves which are added\ntogether for the final result. <br /><br />Another way to adjust the\ncharacter of the resulting sequence is the scale of the input\ncoordinates. As the function works within an infinite space the value of\nthe coordinates doesn&#39;t matter as such, only the distance between\nsuccessive coordinates does (eg. when using <b>noise()</b> within a\nloop). As a general rule the smaller the difference between coordinates,\nthe smoother the resulting noise sequence will be. Steps of 0.005-0.03\nwork best for most applications, but this will differ depending on use.</p>\n","itemtype":"method","name":"noise","params":[{"name":"x","description":"<p>x-coordinate in noise space</p>\n","type":"Number"},{"name":"y","description":"<p>y-coordinate in noise space</p>\n","type":"Number"},{"name":"z","description":"<p>z-coordinate in noise space</p>\n","type":"Number"}],"return":{"description":"Perlin noise value (between 0 and 1) at specified\n coordinates","type":"Number"},"example":["\n<div>\n<code>var xoff = 0.0;\n\nfunction draw() {\n background(204);\n xoff = xoff + .01;\n var n = noise(xoff) * width;\n line(n, 0, n, height);\n}\n</code>\n</div>\n<div>\n<code>var noiseScale=0.02;\n\nfunction draw() {\n background(0);\n for (var x=0; x < width; x++) {\n var noiseVal = noise((mouseX+x)*noiseScale, mouseY*noiseScale);\n stroke(noiseVal*255);\n line(x, mouseY+noiseVal*80, x, height);\n }\n}\n</code>\n</div>"],"class":"p5","module":"Math","submodule":"Noise"},{"file":"src/math/noise.js","line":165,"description":"<p>Adjusts the character and level of detail produced by the Perlin noise\n function. Similar to harmonics in physics, noise is computed over\n several octaves. Lower octaves contribute more to the output signal and\n as such define the overall intensity of the noise, whereas higher octaves\n create finer grained details in the noise sequence.\n <br><br>\n By default, noise is computed over 4 octaves with each octave contributing\n exactly half than its predecessor, starting at 50% strength for the 1st\n octave. This falloff amount can be changed by adding an additional function\n parameter. Eg. a falloff factor of 0.75 means each octave will now have\n 75% impact (25% less) of the previous lower octave. Any value between\n 0.0 and 1.0 is valid, however note that values greater than 0.5 might\n result in greater than 1.0 values returned by <b>noise()</b>.\n <br><br>\n By changing these parameters, the signal created by the <b>noise()</b>\n function can be adapted to fit very specific needs and characteristics.</p>\n","itemtype":"method","name":"noiseDetail","params":[{"name":"lod","description":"<p>number of octaves to be used by the noise</p>\n","type":"Number"},{"name":"falloff","description":"<p>falloff factor for each octave</p>\n","type":"Number"}],"example":["\n <div>\n <code>\nvar noiseVal;\n var noiseScale=0.02;\nfunction setup() {\n createCanvas(100,100);\n }\nfunction draw() {\n background(0);\n for (var y = 0; y < height; y++) {\n for (var x = 0; x < width/2; x++) {\n noiseDetail(2,0.2);\n noiseVal = noise((mouseX+x) * noiseScale,\n (mouseY+y) * noiseScale);\n stroke(noiseVal*255);\n point(x,y);\n noiseDetail(8,0.65);\n noiseVal = noise((mouseX + x + width/2) * noiseScale,\n (mouseY + y) * noiseScale);\n stroke(noiseVal*255);\n point(x + width/2, y);\n }\n }\n }\n </code>\n </div>"],"class":"p5","module":"Math","submodule":"Noise"},{"file":"src/math/noise.js","line":223,"description":"<p>Sets the seed value for <b>noise()</b>. By default, <b>noise()</b>\nproduces different results each time the program is run. Set the\n<b>value</b> parameter to a constant to return the same pseudo-random\nnumbers each time the software is run.</p>\n","itemtype":"method","name":"noiseSeed","params":[{"name":"seed","description":"<p>the seed value</p>\n","type":"Number"}],"example":["\n<div>\n<code>var xoff = 0.0;\n\nfunction setup() {\n noiseSeed(99);\n stroke(0, 10);\n}\n\nfunction draw() {\n xoff = xoff + .01;\n var n = noise(xoff) * width;\n line(n, 0, n, height);\n}\n</code>\n</div>"],"class":"p5","module":"Math","submodule":"Noise"},{"file":"src/math/p5.Vector.js","line":65,"description":"<p>The x component of the vector</p>\n","itemtype":"property","name":"x","type":"{Number}","class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":71,"description":"<p>The y component of the vector</p>\n","itemtype":"property","name":"y","type":"{Number}","class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":77,"description":"<p>The z component of the vector</p>\n","itemtype":"property","name":"z","type":"{Number}","class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":85,"description":"<p>Returns a string representation of a vector v by calling String(v)\nor v.toString(). This method is useful for logging vectors in the\nconsole.</p>\n","itemtype":"method","name":"toString","example":["\n<div class = \"norender\"><code>\nfunction setup() {\n var v = createVector(20,30);\n println(String(v)); // prints \"p5.Vector Object : [20, 30, 0]\"\n}\n</div></code>\n"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":103,"description":"<p>Sets the x, y, and z component of the vector using two or three separate\nvariables, the data from a p5.Vector, or the values from a float array.</p>\n","itemtype":"method","name":"set","params":[{"name":"x","description":"<p>the x component of the vector or a\n p5.Vector or an Array</p>\n","type":"Number|p5.Vector|Array","optional":true},{"name":"y","description":"<p>the y component of the vector</p>\n","type":"Number","optional":true},{"name":"z","description":"<p>the z component of the vector</p>\n","type":"Number","optional":true}],"example":["\n<div class=\"norender\">\n<code>\nfunction setup() {\n var v = createVector(1, 2, 3);\n v.set(4,5,6); // Sets vector to [4, 5, 6]\n\n var v1 = createVector(0, 0, 0);\n var arr = [1, 2, 3];\n v1.set(arr); // Sets vector to [1, 2, 3]\n}\n</code>\n</div>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":145,"description":"<p>Gets a copy of the vector, returns a p5.Vector object.</p>\n","itemtype":"method","name":"copy","return":{"description":"the copy of the p5.Vector object","type":"p5.Vector"},"example":["\n<div class=\"norender\">\n<code>\nvar v1 = createVector(1, 2, 3);\nvar v2 = v1.copy();\nprintln(v1.x == v2.x && v1.y == v2.y && v1.z == v2.z);\n// Prints \"true\"\n</code>\n</div>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":168,"description":"<p>Adds x, y, and z components to a vector, adds one vector to another, or\nadds two independent vectors together. The version of the method that adds\ntwo vectors together is a static method and returns a p5.Vector, the others\nacts directly on the vector. See the examples for more context.</p>\n","itemtype":"method","name":"add","chainable":1,"params":[{"name":"x","description":"<p>the x component of the vector to be\n added or a p5.Vector or an Array</p>\n","type":"Number|p5.Vector|Array"},{"name":"y","description":"<p>the y component of the vector to be\n added</p>\n","type":"Number","optional":true},{"name":"z","description":"<p>the z component of the vector to be\n added</p>\n","type":"Number","optional":true}],"return":{"description":"the p5.Vector object.","type":"p5.Vector"},"example":["\n<div class=\"norender\">\n<code>\nvar v = createVector(1, 2, 3);\nv.add(4,5,6);\n// v's compnents are set to [5, 7, 9]\n</code>\n</div>\n<div class=\"norender\">\n<code>\n// Static method\nvar v1 = createVector(1, 2, 3);\nvar v2 = createVector(2, 3, 4);\n\nvar v3 = p5.Vector.add(v1, v2);\n// v3 has components [3, 5, 7]\n</code>\n</div>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":221,"description":"<p>Subtracts x, y, and z components from a vector, subtracts one vector from\nanother, or subtracts two independent vectors. The version of the method\nthat subtracts two vectors is a static method and returns a p5.Vector, the\nother acts directly on the vector. See the examples for more context.</p>\n","itemtype":"method","name":"sub","chainable":1,"params":[{"name":"x","description":"<p>the x component of the vector or a\n p5.Vector or an Array</p>\n","type":"Number|p5.Vector|Array"},{"name":"y","description":"<p>the y component of the vector</p>\n","type":"Number","optional":true},{"name":"z","description":"<p>the z component of the vector</p>\n","type":"Number","optional":true}],"return":{"description":"p5.Vector object.","type":"p5.Vector"},"example":["\n<div class=\"norender\">\n<code>\nvar v = createVector(4, 5, 6);\nv.sub(1, 1, 1);\n// v's compnents are set to [3, 4, 5]\n</code>\n</div>\n\n<div class=\"norender\">\n<code>\n// Static method\nvar v1 = createVector(2, 3, 4);\nvar v2 = createVector(1, 2, 3);\n\nvar v3 = p5.Vector.sub(v1, v2);\n// v3 has compnents [1, 1, 1]\n</code>\n</div>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":273,"description":"<p>Multiply the vector by a scalar. The static version of this method\ncreates a new p5.Vector while the non static version acts on the vector\ndirectly. See the examples for more context.</p>\n","itemtype":"method","name":"mult","chainable":1,"params":[{"name":"n","description":"<p>the number to multiply with the vector</p>\n","type":"Number"}],"return":{"description":"a reference to the p5.Vector object (allow chaining)","type":"p5.Vector"},"example":["\n<div class=\"norender\">\n<code>\nvar v = createVector(1, 2, 3);\nv.mult(2);\n// v's compnents are set to [2, 4, 6]\n</code>\n</div>\n\n<div class=\"norender\">\n<code>\n// Static method\nvar v1 = createVector(1, 2, 3);\nvar v2 = p5.Vector.mult(v1, 2);\n// v2 has compnents [2, 4, 6]\n</code>\n</div>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":307,"description":"<p>Divide the vector by a scalar. The static version of this method creates a\nnew p5.Vector while the non static version acts on the vector directly.\nSee the examples for more context.</p>\n","itemtype":"method","name":"div","chainable":1,"params":[{"name":"n","description":"<p>the number to divide the vector by</p>\n","type":"Number"}],"return":{"description":"a reference to the p5.Vector object (allow chaining)","type":"p5.Vector"},"example":["\n<div class=\"norender\">\n<code>\nvar v = createVector(6, 4, 2);\nv.div(2); //v's compnents are set to [3, 2, 1]\n</code>\n</div>\n\n<div class=\"norender\">\n<code>\n// Static method\nvar v1 = createVector(6, 4, 2);\nvar v2 = p5.Vector.div(v, 2);\n// v2 has compnents [3, 2, 1]\n</code>\n</div>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":340,"description":"<p>Calculates the magnitude (length) of the vector and returns the result as\na float (this is simply the equation sqrt(x<em>x + y</em>y + z*z).)</p>\n","itemtype":"method","name":"mag","return":{"description":"magnitude of the vector","type":"Number"},"example":["\n<div class=\"norender\">\n<code>\nvar v = createVector(20.0, 30.0, 40.0);\nvar m = v.mag();\nprintln(m); // Prints \"53.85164807134504\"\n</code>\n</div>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":359,"description":"<p>Calculates the squared magnitude of the vector and returns the result\nas a float (this is simply the equation <em>(x<em>x + y</em>y + z*z)</em>.)\nFaster if the real length is not required in the\ncase of comparing vectors, etc.</p>\n","itemtype":"method","name":"magSq","return":{"description":"squared magnitude of the vector","type":"Number"},"example":["\n<div class=\"norender\">\n<code>\n// Static method\nvar v1 = createVector(6, 4, 2);\nprintln(v1.magSq()); // Prints \"56\"\n</code>\n</div>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":381,"description":"<p>Calculates the dot product of two vectors. The version of the method\nthat computes the dot product of two independent vectors is a static\nmethod. See the examples for more context.</p>\n","itemtype":"method","name":"dot","params":[{"name":"x","description":"<p>x component of the vector or a p5.Vector</p>\n","type":"Number|p5.Vector"},{"name":"y","description":"<p>y component of the vector</p>\n","type":"Number","optional":true},{"name":"z","description":"<p>z component of the vector</p>\n","type":"Number","optional":true}],"return":{"description":"the dot product","type":"Number"},"example":["\n<div class=\"norender\">\n<code>\nvar v1 = createVector(1, 2, 3);\nvar v2 = createVector(2, 3, 4);\n\nprintln(v1.dot(v2)); // Prints \"20\"\n</code>\n</div>\n\n<div class=\"norender\">\n<code>\n//Static method\nvar v1 = createVector(1, 2, 3);\nvar v2 = createVector(3, 2, 1);\nprint (p5.Vector.dot(v1, v2)); // Prints \"10\"\n</code>\n</div>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":421,"description":"<p>Calculates and returns a vector composed of the cross product between\ntwo vectors. Both the static and non static methods return a new p5.Vector.\nSee the examples for more context.</p>\n","itemtype":"method","name":"cross","params":[{"name":"v","description":"<p>p5.Vector to be crossed</p>\n","type":"p5.Vector"}],"return":{"description":"p5.Vector composed of cross product","type":"p5.Vector"},"example":["\n<div class=\"norender\">\n<code>\nvar v1 = createVector(1, 2, 3);\nvar v2 = createVector(1, 2, 3);\n\nv1.cross(v2); // v's components are [0, 0, 0]\n</code>\n</div>\n\n<div class=\"norender\">\n<code>\n// Static method\nvar v1 = createVector(1, 0, 0);\nvar v2 = createVector(0, 1, 0);\n\nvar crossProduct = p5.Vector.cross(v1, v2);\n// crossProduct has components [0, 0, 1]\n</code>\n</div>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":461,"description":"<p>Calculates the Euclidean distance between two points (considering a\npoint as a vector object).</p>\n","itemtype":"method","name":"dist","params":[{"name":"v","description":"<p>the x, y, and z coordinates of a p5.Vector</p>\n","type":"p5.Vector"}],"return":{"description":"the distance","type":"Number"},"example":["\n<div class=\"norender\">\n<code>\nvar v1 = createVector(1, 0, 0);\nvar v2 = createVector(0, 1, 0);\n\nvar distance = v1.dist(v2); // distance is 1.4142...\n</code>\n</div>\n<div class=\"norender\">\n<code>\n// Static method\nvar v1 = createVector(1, 0, 0);\nvar v2 = createVector(0, 1, 0);\n\nvar distance = p5.Vector.dist(v1,v2);\n// distance is 1.4142...\n</code>\n</div>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":493,"description":"<p>Normalize the vector to length 1 (make it a unit vector).</p>\n","itemtype":"method","name":"normalize","return":{"description":"normalized p5.Vector","type":"p5.Vector"},"example":["\n<div class=\"norender\">\n<code>\nvar v = createVector(10, 20, 2);\n// v has compnents [10.0, 20.0, 2.0]\nv.normalize();\n// v's compnents are set to\n// [0.4454354, 0.8908708, 0.089087084]\n</code>\n</div>\n"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":514,"description":"<p>Limit the magnitude of this vector to the value used for the <b>max</b>\nparameter.</p>\n","itemtype":"method","name":"limit","params":[{"name":"max","description":"<p>the maximum magnitude for the vector</p>\n","type":"Number"}],"return":{"description":"the modified p5.Vector","type":"p5.Vector"},"example":["\n<div class=\"norender\">\n<code>\nvar v = createVector(10, 20, 2);\n// v has compnents [10.0, 20.0, 2.0]\nv.limit(5);\n// v's compnents are set to\n// [2.2271771, 4.4543543, 0.4454354]\n</code>\n</div>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":541,"description":"<p>Set the magnitude of this vector to the value used for the <b>len</b>\nparameter.</p>\n","itemtype":"method","name":"setMag","params":[{"name":"len","description":"<p>the new length for this vector</p>\n","type":"Number"}],"return":{"description":"the modified p5.Vector","type":"p5.Vector"},"example":["\n<div class=\"norender\">\n<code>\nvar v1 = createVector(10, 20, 2);\n// v has compnents [10.0, 20.0, 2.0]\nv1.setMag(10);\n// v's compnents are set to [6.0, 8.0, 0.0]\n</code>\n</div>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":562,"description":"<p>Calculate the angle of rotation for this vector (only 2D vectors)</p>\n","itemtype":"method","name":"heading","return":{"description":"the angle of rotation","type":"Number"},"example":["\n<div class = \"norender\"><code>\nfunction setup() {\n var v1 = createVector(30,50);\n println(v1.heading()); // 1.0303768265243125\n\n var v1 = createVector(40,50);\n println(v1.heading()); // 0.8960553845713439\n\n var v1 = createVector(30,70);\n println(v1.heading()); // 1.1659045405098132\n}\n</div></code>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":594,"description":"<p>Rotate the vector by an angle (only 2D vectors), magnitude remains the\nsame</p>\n","itemtype":"method","name":"rotate","params":[{"name":"angle","description":"<p>the angle of rotation</p>\n","type":"Number"}],"return":{"description":"the modified p5.Vector","type":"p5.Vector"},"example":["\n<div class=\"norender\">\n<code>\nvar v = createVector(10.0, 20.0);\n// v has compnents [10.0, 20.0, 0.0]\nv.rotate(HALF_PI);\n// v's compnents are set to [-20.0, 9.999999, 0.0]\n</code>\n</div>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":624,"description":"<p>Linear interpolate the vector to another vector</p>\n","itemtype":"method","name":"lerp","params":[{"name":"x","description":"<p>the x component or the p5.Vector to lerp to</p>\n","type":"p5.Vector"},{"name":"y","description":"<p>y the y component</p>\n","type":"p5.Vector","optional":true},{"name":"z","description":"<p>z the z component</p>\n","type":"p5.Vector","optional":true},{"name":"amt","description":"<p>the amount of interpolation; some value between 0.0\n (old vector) and 1.0 (new vector). 0.1 is very near\n the new vector. 0.5 is halfway in between.</p>\n","type":"Number"}],"return":{"description":"the modified p5.Vector","type":"p5.Vector"},"example":["\n<div class=\"norender\">\n<code>\nvar v = createVector(1, 1, 0);\n\nv.lerp(3, 3, 0, 0.5); // v now has components [2,2,0]\n</code>\n</div>\n\n<div class=\"norender\">\n<code>\nvar v1 = createVector(0, 0, 0);\nvar v2 = createVector(100, 100, 0);\n\nvar v3 = p5.Vector.lerp(v1, v2, 0.5);\n// v3 has components [50,50,0]\n</code>\n</div>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":664,"description":"<p>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 <b>p5.Vector.copy()</b> method to copy into your own\narray.</p>\n","itemtype":"method","name":"array","return":{"description":"an Array with the 3 values","type":"Array"},"example":["\n<div class = \"norender\"><code>\nfunction setup() {\n var v = createVector(20,30);\n println(v.array()); // Prints : Array [20, 30, 0]\n}\n</div></code>\n<div class=\"norender\">\n<code>\nvar v = createVector(10.0, 20.0, 30.0);\nvar f = v.array();\nprintln(f[0]); // Prints \"10.0\"\nprintln(f[1]); // Prints \"20.0\"\nprintln(f[2]); // Prints \"30.0\"\n</code>\n</div>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":693,"description":"<p>Equality check against a p5.Vector</p>\n","itemtype":"method","name":"equals","params":[{"name":"x","description":"<p>the x component of the vector or a\n p5.Vector or an Array</p>\n","type":"Number|p5.Vector|Array","optional":true},{"name":"y","description":"<p>the y component of the vector</p>\n","type":"Number","optional":true},{"name":"z","description":"<p>the z component of the vector</p>\n","type":"Number","optional":true}],"return":{"description":"whether the vectors are equals","type":"Boolean"},"example":["\n<div class = \"norender\"><code>\nv1 = createVector(5,10,20);\nv2 = createVector(5,10,20);\nv3 = createVector(13,10,19);\n\nprintln(v1.equals(v2.x,v2.y,v2.z)); // true\nprintln(v1.equals(v3.x,v3.y,v3.z)); // false\n</div></code>\n<div class=\"norender\">\n<code>\nvar v1 = createVector(10.0, 20.0, 30.0);\nvar v2 = createVector(10.0, 20.0, 30.0);\nvar v3 = createVector(0.0, 0.0, 0.0);\nprint (v1.equals(v2)) // true\nprint (v1.equals(v3)) // false\n</code>\n</div>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":743,"description":"<p>Make a new 2D unit vector from an angle</p>\n","itemtype":"method","name":"fromAngle","static":1,"params":[{"name":"angle","description":"<p>the desired angle</p>\n","type":"Number"}],"return":{"description":"the new p5.Vector object","type":"p5.Vector"},"example":["\n<div>\n<code>\nfunction draw() {\n background (200);\n\n // Create a variable, proportional to the mouseX,\n // varying from 0-360, to represent an angle in degrees.\n angleMode(DEGREES);\n var myDegrees = map(mouseX, 0,width, 0,360);\n\n // Display that variable in an onscreen text.\n // (Note the nfc() function to truncate additional decimal places,\n // and the \"\\xB0\" character for the degree symbol.)\n var readout = \"angle = \" + nfc(myDegrees,1,1) + \"\\xB0\"\n noStroke();\n fill (0);\n text (readout, 5, 15);\n\n // Create a p5.Vector using the fromAngle function,\n // and extract its x and y components.\n var v = p5.Vector.fromAngle(radians(myDegrees));\n var vx = v.x;\n var vy = v.y;\n\n push();\n translate (width/2, height/2);\n noFill();\n stroke (150);\n line (0,0, 30,0);\n stroke (0);\n line (0,0, 30*vx, 30*vy);\n pop()\n}\n</code>\n</div>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":800,"description":"<p>Make a new 2D unit vector from a random angle</p>\n","itemtype":"method","name":"random2D","static":1,"return":{"description":"the new p5.Vector object","type":"p5.Vector"},"example":["\n<div class=\"norender\">\n<code>\nvar v = p5.Vector.random2D();\n// May make v's attributes something like:\n// [0.61554617, -0.51195765, 0.0] or\n// [-0.4695841, -0.14366731, 0.0] or\n// [0.6091097, -0.22805278, 0.0]\n</code>\n</div>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":833,"description":"<p>Make a new random 3D unit vector.</p>\n","itemtype":"method","name":"random3D","static":1,"return":{"description":"the new p5.Vector object","type":"p5.Vector"},"example":["\n<div class=\"norender\">\n<code>\nvar v = p5.Vector.random3D();\n// May make v's attributes something like:\n// [0.61554617, -0.51195765, 0.599168] or\n// [-0.4695841, -0.14366731, -0.8711202] or\n// [0.6091097, -0.22805278, -0.7595902]\n</code>\n</div>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":870,"description":"<p>Adds two vectors together and returns a new one.</p>\n","static":1,"params":[{"name":"v1","description":"<p>a p5.Vector to add</p>\n","type":"p5.Vector"},{"name":"v2","description":"<p>a p5.Vector to add</p>\n","type":"p5.Vector"},{"name":"target","description":"<p>if undefined a new vector will be created</p>\n","type":"p5.Vector"}],"return":{"description":"the resulting p5.Vector","type":"p5.Vector"},"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":891,"description":"<p>Subtracts one p5.Vector from another and returns a new one. The second\nvector (v2) is subtracted from the first (v1), resulting in v1-v2.</p>\n","static":1,"params":[{"name":"v1","description":"<p>a p5.Vector to subtract from</p>\n","type":"p5.Vector"},{"name":"v2","description":"<p>a p5.Vector to subtract</p>\n","type":"p5.Vector"},{"name":"target","description":"<p>if undefined a new vector will be created</p>\n","type":"p5.Vector"}],"return":{"description":"the resulting p5.Vector","type":"p5.Vector"},"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":913,"description":"<p>Multiplies a vector by a scalar and returns a new vector.</p>\n","static":1,"params":[{"name":"v","description":"<p>the p5.Vector to multiply</p>\n","type":"p5.Vector"},{"name":"n","description":"<p>the scalar</p>\n","type":"Number"},{"name":"target","description":"<p>if undefined a new vector will be created</p>\n","type":"p5.Vector"}],"return":{"description":"the resulting new p5.Vector","type":"p5.Vector"},"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":932,"description":"<p>Divides a vector by a scalar and returns a new vector.</p>\n","static":1,"params":[{"name":"v","description":"<p>the p5.Vector to divide</p>\n","type":"p5.Vector"},{"name":"n","description":"<p>the scalar</p>\n","type":"Number"},{"name":"target","description":"<p>if undefined a new vector will be created</p>\n","type":"p5.Vector"}],"return":{"description":"the resulting new p5.Vector","type":"p5.Vector"},"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":952,"description":"<p>Calculates the dot product of two vectors.</p>\n","static":1,"params":[{"name":"v1","description":"<p>the first p5.Vector</p>\n","type":"p5.Vector"},{"name":"v2","description":"<p>the second p5.Vector</p>\n","type":"p5.Vector"}],"return":{"description":"the dot product","type":"Number"},"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":964,"description":"<p>Calculates the cross product of two vectors.</p>\n","static":1,"params":[{"name":"v1","description":"<p>the first p5.Vector</p>\n","type":"p5.Vector"},{"name":"v2","description":"<p>the second p5.Vector</p>\n","type":"p5.Vector"}],"return":{"description":"the cross product","type":"Number"},"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":976,"description":"<p>Calculates the Euclidean distance between two points (considering a\npoint as a vector object).</p>\n","static":1,"params":[{"name":"v1","description":"<p>the first p5.Vector</p>\n","type":"p5.Vector"},{"name":"v2","description":"<p>the second p5.Vector</p>\n","type":"p5.Vector"}],"return":{"description":"the distance","type":"Number"},"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":989,"description":"<p>Linear interpolate a vector to another vector and return the result as a\nnew vector.</p>\n","static":1,"params":[{"name":"v1","description":"<p>a starting p5.Vector</p>\n","type":"p5.Vector"},{"name":"v2","description":"<p>the p5.Vector to lerp to</p>\n","type":"p5.Vector"},{"name":"the","description":"<p>amount of interpolation; some value between 0.0\n (old vector) and 1.0 (new vector). 0.1 is very near\n the new vector. 0.5 is halfway in between.</p>\n","type":"Number"}],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":1010,"description":"<p>Calculates and returns the angle (in radians) between two vectors.</p>\n","itemtype":"method","name":"angleBetween","static":1,"params":[{"name":"v1","description":"<p>the x, y, and z components of a p5.Vector</p>\n","type":"p5.Vector"},{"name":"v2","description":"<p>the x, y, and z components of a p5.Vector</p>\n","type":"p5.Vector"}],"return":{"description":"the angle between (in radians)","type":"Number"},"example":["\n<div class=\"norender\">\n<code>\nvar v1 = createVector(1, 0, 0);\nvar v2 = createVector(0, 1, 0);\n\nvar angle = p5.Vector.angleBetween(v1, v2);\n// angle is PI/2\n</code>\n</div>"],"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/p5.Vector.js","line":1038,"static":1,"class":"p5.Vector","module":"Math","submodule":"Math"},{"file":"src/math/random.js","line":45,"description":"<p>Sets the seed value for random().</p>\n<p>By default, random() produces different results each time the program\nis run. Set the seed parameter to a constant to return the same\npseudo-random numbers each time the software is run.</p>\n","itemtype":"method","name":"randomSeed","params":[{"name":"seed","description":"<p>the seed value</p>\n","type":"Number"}],"example":["\n<div>\n<code>\nrandomSeed(99);\nfor (var i=0; i < 100; i++) {\n var r = random(0, 255);\n stroke(r);\n line(i, 0, i, 100);\n}\n</code>\n</div>"],"class":"p5","module":"Math","submodule":"Random"},{"file":"src/math/random.js","line":71,"description":"<p>Return a random floating-point number.</p>\n<p>Takes either 0, 1 or 2 arguments.</p>\n<p>If no argument is given, returns a random number from 0\nup to (but not including) 1.</p>\n<p>If one argument is given and it is a number, returns a random number from 0\nup to (but not including) the number.</p>\n<p>If one argument is given and it is an array, returns a random element from\nthat array.</p>\n<p>If two arguments are given, returns a random number from the\nfirst argument up to (but not including) the second argument.</p>\n","itemtype":"method","name":"random","return":{"description":"the random number or a random element in choices","type":"Number|mixed"},"example":["\n<div>\n<code>\nfor (var i = 0; i < 100; i++) {\n var r = random(50);\n stroke(r*5);\n line(50, i, 50+r, i);\n}\n</code>\n</div>\n<div>\n<code>\nfor (var i = 0; i < 100; i++) {\n var r = random(-50, 50);\n line(50,i,50+r,i);\n}\n</code>\n</div>\n<div>\n<code>\n// Get a random element from an array using the random(Array) syntax\nvar words = [ \"apple\", \"bear\", \"cat\", \"dog\" ];\nvar word = random(words); // select random word\ntext(word,10,50); // draw the word\n</code>\n</div>"],"class":"p5","module":"Math","submodule":"Random","overloads":[{"line":71,"params":[{"name":"min","description":"<p>the lower bound (inclusive)</p>\n","type":"Number","optional":true},{"name":"max","description":"<p>the upper bound (exclusive)</p>\n","type":"Number","optional":true}]},{"line":119,"params":[{"name":"choices","description":"<p>the array to choose from</p>\n","type":"Array"}]}]},{"file":"src/math/random.js","line":155,"description":"<p>Returns a random number fitting a Gaussian, or\n normal, distribution. There is theoretically no minimum or maximum\n value that randomGaussian() might return. Rather, there is\n just a very low probability that values far from the mean will be\n returned; and a higher probability that numbers near the mean will\n be returned.\n <br><br>\n Takes either 0, 1 or 2 arguments.<br>\n If no args, returns a mean of 0 and standard deviation of 1.<br>\n If one arg, that arg is the mean (standard deviation is 1).<br>\n If two args, first is mean, second is standard deviation.</p>\n","itemtype":"method","name":"randomGaussian","params":[{"name":"mean","description":"<p>the mean</p>\n","type":"Number"},{"name":"sd","description":"<p>the standard deviation</p>\n","type":"Number"}],"return":{"description":"the random number","type":"Number"},"example":["\n <div>\n <code>for (var y = 0; y < 100; y++) {\n var x = randomGaussian(50,15);\n line(50, y, x, y);\n}\n </code>\n </div>\n <div>\n <code>\nvar distribution = new Array(360);\n\nfunction setup() {\n createCanvas(100, 100);\n for (var i = 0; i < distribution.length; i++) {\n distribution[i] = floor(randomGaussian(0,15));\n }\n}\n\nfunction draw() {\n background(204);\n translate(width/2, width/2);\n for (var i = 0; i < distribution.length; i++) {\n rotate(TWO_PI/distribution.length);\n stroke(0);\n var dist = abs(distribution[i]);\n line(0, 0, dist, 0);\n }\n}\n </code>\n </div>"],"class":"p5","module":"Math","submodule":"Random"},{"file":"src/math/trigonometry.js","line":18,"description":"<p>The inverse of cos(), returns the arc cosine of a value. This function\nexpects the values in the range of -1 to 1 and values are returned in\nthe range 0 to PI (3.1415927).</p>\n","itemtype":"method","name":"acos","params":[{"name":"value","description":"<p>the value whose arc cosine is to be returned</p>\n","type":"Number"}],"return":{"description":"the arc cosine of the given value","type":"Number"},"example":["\n<div class= “norender\">\n<code>\nvar a = PI;\nvar c = cos(a);\nvar ac = acos(c);\n// Prints: \"3.1415927 : -1.0 : 3.1415927\"\nprintln(a + \" : \" + c + \" : \" + ac);\n</code>\n</div>\n\n<div class= “norender\">\n<code>\nvar a = PI + PI/4.0;\nvar c = cos(a);\nvar ac = acos(c);\n// Prints: \"3.926991 : -0.70710665 : 2.3561943\"\nprintln(a + \" : \" + c + \" : \" + ac);\n</code>\n</div>"],"class":"p5","module":"Math","submodule":"Trigonometry"},{"file":"src/math/trigonometry.js","line":56,"description":"<p>The inverse of sin(), returns the arc sine of a value. This function\nexpects the values in the range of -1 to 1 and values are returned\nin the range -PI/2 to PI/2.</p>\n","itemtype":"method","name":"asin","params":[{"name":"value","description":"<p>the value whose arc sine is to be returned</p>\n","type":"Number"}],"return":{"description":"the arc sine of the given value","type":"Number"},"example":["\n<div class= “norender\">\n<code>\nvar a = PI + PI/3;\nvar s = sin(a);\nvar as = asin(s);\n// Prints: \"1.0471976 : 0.86602545 : 1.0471976\"\nprintln(a + \" : \" + s + \" : \" + as);\n</code>\n</div>\n\n<div class= “norender\">\n<code>\nvar a = PI + PI/3.0;\nvar s = sin(a);\nvar as = asin(s);\n// Prints: \"4.1887903 : -0.86602545 : -1.0471976\"\nprintln(a + \" : \" + s + \" : \" + as);\n</code>\n</div>\n"],"class":"p5","module":"Math","submodule":"Trigonometry"},{"file":"src/math/trigonometry.js","line":95,"description":"<p>The inverse of tan(), returns the arc tangent of a value. This function\nexpects the values in the range of -Infinity to Infinity (exclusive) and\nvalues are returned in the range -PI/2 to PI/2.</p>\n","itemtype":"method","name":"atan","params":[{"name":"value","description":"<p>the value whose arc tangent is to be returned</p>\n","type":"Number"}],"return":{"description":"the arc tangent of the given value","type":"Number"},"example":["\n<div class= “norender\">\n<code>\nvar a = PI + PI/3;\nvar t = tan(a);\nvar at = atan(t);\n// Prints: \"1.0471976 : 1.7320509 : 1.0471976\"\nprintln(a + \" : \" + t + \" : \" + at);\n</code>\n</div>\n\n<div class= “norender\">\n<code>\nvar a = PI + PI/3.0;\nvar t = tan(a);\nvar at = atan(t);\n// Prints: \"4.1887903 : 1.7320513 : 1.0471977\"\nprintln(a + \" : \" + t + \" : \" + at);\n</code>\n</div>\n"],"class":"p5","module":"Math","submodule":"Trigonometry"},{"file":"src/math/trigonometry.js","line":134,"description":"<p>Calculates the angle (in radians) from a specified point to the coordinate\norigin as measured from the positive x-axis. Values are returned as a\nfloat in the range from PI to -PI. The atan2() function is most often used\nfor orienting geometry to the position of the cursor.\n<br><br>\nNote: The y-coordinate of the point is the first parameter, and the\nx-coordinate is the second parameter, due the the structure of calculating\nthe tangent.</p>\n","itemtype":"method","name":"atan2","params":[{"name":"y","description":"<p>y-coordinate of the point</p>\n","type":"Number"},{"name":"x","description":"<p>x-coordinate of the point</p>\n","type":"Number"}],"return":{"description":"the arc tangent of the given point","type":"Number"},"example":["\n<div>\n<code>\nfunction draw() {\n background(204);\n translate(width/2, height/2);\n var a = atan2(mouseY-height/2, mouseX-width/2);\n rotate(a);\n rect(-30, -5, 60, 10);\n}\n</code>\n</div>"],"class":"p5","module":"Math","submodule":"Trigonometry"},{"file":"src/math/trigonometry.js","line":170,"description":"<p>Calculates the cosine of an angle. This function takes into account the\ncurrent angleMode. Values are returned in the range -1 to 1.</p>\n","itemtype":"method","name":"cos","params":[{"name":"angle","description":"<p>the angle</p>\n","type":"Number"}],"return":{"description":"the cosine of the angle","type":"Number"},"example":["\n<div>\n<code>\nvar a = 0.0;\nvar inc = TWO_PI/25.0;\nfor (var i = 0; i < 25; i++) {\n line(i*4, 50, i*4, 50+cos(a)*40.0);\n a = a + inc;\n}\n</code>\n</div>\n"],"class":"p5","module":"Math","submodule":"Trigonometry"},{"file":"src/math/trigonometry.js","line":199,"description":"<p>Calculates the sine of an angle. This function takes into account the\ncurrent angleMode. Values are returned in the range -1 to 1.</p>\n","itemtype":"method","name":"sin","params":[{"name":"angle","description":"<p>the angle</p>\n","type":"Number"}],"return":{"description":"the sine of the angle","type":"Number"},"example":["\n<div>\n<code>\nvar a = 0.0;\nvar inc = TWO_PI/25.0;\nfor (var i = 0; i < 25; i++) {\n line(i*4, 50, i*4, 50+sin(a)*40.0);\n a = a + inc;\n}\n</code>\n</div>"],"class":"p5","module":"Math","submodule":"Trigonometry"},{"file":"src/math/trigonometry.js","line":227,"description":"<p>Calculates the tangent of an angle. This function takes into account\nthe current angleMode. Values are returned in the range -1 to 1.</p>\n","itemtype":"method","name":"tan","params":[{"name":"angle","description":"<p>the angle</p>\n","type":"Number"}],"return":{"description":"the tangent of the angle","type":"Number"},"example":["\n<div>\n<code>\n var a = 0.0;\n var inc = TWO_PI/50.0;\n for (var i = 0; i < 100; i = i+2) {\n line(i, 50, i, 50+tan(a)*2.0);\n a = a + inc;\n }\n</code>\n</div>\n"],"class":"p5","module":"Math","submodule":"Trigonometry"},{"file":"src/math/trigonometry.js","line":256,"description":"<p>Converts a radian measurement to its corresponding value in degrees.\nRadians and degrees are two ways of measuring the same thing. There are\n360 degrees in a circle and 2*PI radians in a circle. For example,\n90° = PI/2 = 1.5707964.</p>\n","itemtype":"method","name":"degrees","params":[{"name":"radians","description":"<p>the radians value to convert to degrees</p>\n","type":"Number"}],"return":{"description":"the converted angle","type":"Number"},"example":["\n<div class= “norender\">\n<code>\nvar rad = PI/4;\nvar deg = degrees(rad);\nprintln(rad + \" radians is \" + deg + \" degrees\");\n// Prints: 0.7853981633974483 radians is 45 degrees\n</code>\n</div>\n"],"class":"p5","module":"Math","submodule":"Trigonometry"},{"file":"src/math/trigonometry.js","line":282,"description":"<p>Converts a degree measurement to its corresponding value in radians.\nRadians and degrees are two ways of measuring the same thing. There are\n360 degrees in a circle and 2*PI radians in a circle. For example,\n90° = PI/2 = 1.5707964.</p>\n","itemtype":"method","name":"radians","params":[{"name":"degrees","description":"<p>the degree value to convert to radians</p>\n","type":"Number"}],"return":{"description":"the converted angle","type":"Number"},"example":["\n<div class= “norender\">\n<code>\nvar deg = 45.0;\nvar rad = radians(deg);\nprintln(deg + \" degrees is \" + rad + \" radians\");\n// Prints: 45 degrees is 0.7853981633974483 radians\n</code>\n</div>"],"class":"p5","module":"Math","submodule":"Trigonometry"},{"file":"src/math/trigonometry.js","line":306,"description":"<p>Sets the current mode of p5 to given mode. Default mode is RADIANS.</p>\n","itemtype":"method","name":"angleMode","params":[{"name":"mode","description":"<p>either RADIANS or DEGREES</p>\n","type":"Constant"}],"example":["\n<div>\n<code>\nfunction draw(){\n background(204);\n angleMode(DEGREES); // Change the mode to DEGREES\n var a = atan2(mouseY-height/2, mouseX-width/2);\n translate(width/2, height/2);\n push();\n rotate(a);\n rect(-20, -5, 40, 10); // Larger rectangle is rotating in degrees\n pop();\n angleMode(RADIANS); // Change the mode to RADIANS\n rotate(a); // var a stays the same\n rect(-40, -5, 20, 10); // Smaller rectangle is rotating in radians\n}\n</code>\n</div>\n"],"class":"p5","module":"Math","submodule":"Trigonometry"},{"file":"src/typography/attributes.js","line":13,"description":"<p>Sets the current alignment for drawing text. Accepts two\narguments: horizAlign (LEFT, CENTER, or RIGHT) and\nvertAlign (TOP, BOTTOM, CENTER, or BASELINE).</p>\n<p>The horizAlign parameter is in reference to the x value\nof the text() function, while the vertAlign parameter is\nin reference to the y value.</p>\n<p>So if you write textAlign(LEFT), you are aligning the left\nedge of your text to the x value you give in text(). If you\nwrite textAlign(RIGHT, TOP), you are aligning the right edge\nof your text to the x value and the top of edge of the text\nto the y value.</p>\n","itemtype":"method","name":"textAlign","params":[{"name":"horizAlign","description":"<p>horizontal alignment, either LEFT,\n CENTER, or RIGHT</p>\n","type":"Constant"},{"name":"vertAlign","description":"<p>vertical alignment, either TOP,\n BOTTOM, CENTER, or BASELINE</p>\n","type":"Constant"}],"return":{"description":"","type":"Number"},"example":["\n<div>\n<code>\ntextSize(16);\ntextAlign(RIGHT);\ntext(\"ABCD\", 50, 30);\ntextAlign(CENTER);\ntext(\"EFGH\", 50, 50);\ntextAlign(LEFT);\ntext(\"IJKL\", 50, 70);\n</code>\n</div>"],"class":"p5","module":"Typography","submodule":"Attributes"},{"file":"src/typography/attributes.js","line":51,"description":"<p>Sets/gets the spacing, in pixels, between lines of text. This\nsetting will be used in all subsequent calls to the text() function.</p>\n","itemtype":"method","name":"textLeading","params":[{"name":"leading","description":"<p>the size in pixels for spacing between lines</p>\n","type":"Number"}],"return":{"description":"","type":"Object|Number"},"example":["\n<div>\n<code>\n// Text to display. The \"\\n\" is a \"new line\" character\nlines = \"L1\\nL2\\nL3\";\ntextSize(12);\n\ntextLeading(10); // Set leading to 10\ntext(lines, 10, 25);\n\ntextLeading(20); // Set leading to 20\ntext(lines, 40, 25);\n\ntextLeading(30); // Set leading to 30\ntext(lines, 70, 25);\n</code>\n</div>"],"class":"p5","module":"Typography","submodule":"Attributes"},{"file":"src/typography/attributes.js","line":80,"description":"<p>Sets/gets the current font size. This size will be used in all subsequent\ncalls to the text() function. Font size is measured in pixels.</p>\n","itemtype":"method","name":"textSize","params":[{"name":"theSize","description":"<p>the size of the letters in units of pixels</p>\n","type":"Number"}],"return":{"description":"","type":"Object|Number"},"example":["\n<div>\n<code>\ntextSize(12);\ntext(\"Font Size 12\", 10, 30);\ntextSize(14);\ntext(\"Font Size 14\", 10, 60);\ntextSize(16);\ntext(\"Font Size 16\", 10, 90);\n</code>\n</div>"],"class":"p5","module":"Typography","submodule":"Attributes"},{"file":"src/typography/attributes.js","line":103,"description":"<p>Sets/gets the style of the text for system fonts to NORMAL, ITALIC, or BOLD.\nNote: this may be is overridden by CSS styling. For non-system fonts\n(opentype, truetype, etc.) please load styled fonts instead.</p>\n","itemtype":"method","name":"textStyle","params":[{"name":"theStyle","description":"<p>styling for text, either NORMAL,\n ITALIC, or BOLD</p>\n","type":"Number/Constant"}],"return":{"description":"","type":"Object|String"},"example":["\n<div>\n<code>\nstrokeWeight(0);\ntextSize(12);\ntextStyle(NORMAL);\ntext(\"Font Style Normal\", 10, 30);\ntextStyle(ITALIC);\ntext(\"Font Style Italic\", 10, 60);\ntextStyle(BOLD);\ntext(\"Font Style Bold\", 10, 90);\n</code>\n</div>"],"class":"p5","module":"Typography","submodule":"Attributes"},{"file":"src/typography/attributes.js","line":130,"description":"<p>Calculates and returns the width of any character or text string.</p>\n","itemtype":"method","name":"textWidth","params":[{"name":"theText","description":"<p>the String of characters to measure</p>\n","type":"String"}],"return":{"description":"","type":"Number"},"example":["\n<div>\n<code>\ntextSize(28);\n\nvar aChar = 'P';\nvar cWidth = textWidth(aChar);\ntext(aChar, 0, 40);\nline(cWidth, 0, cWidth, 50);\n\nvar aString = \"p5.js\";\nvar sWidth = textWidth(aString);\ntext(aString, 0, 85);\nline(sWidth, 50, sWidth, 100);\n</code>\n</div>"],"class":"p5","module":"Typography","submodule":"Attributes"},{"file":"src/typography/attributes.js","line":157,"description":"<p>Returns the ascent of the current font at its current size. The ascent\nrepresents the distance, in pixels, of the tallest character above\nthe baseline.</p>\n","return":{"description":"","type":"Number"},"example":["\n<div>\n<code>\nvar base = height * 0.75;\nvar scalar = 0.8; // Different for each font\n\ntextSize(32); // Set initial text size\nvar asc = textAscent() * scalar; // Calc ascent\nline(0, base - asc, width, base - asc);\ntext(\"dp\", 0, base); // Draw text on baseline\n\ntextSize(64); // Increase text size\nasc = textAscent() * scalar; // Recalc ascent\nline(40, base - asc, width, base - asc);\ntext(\"dp\", 40, base); // Draw text on baseline\n</code>\n</div>"],"class":"p5","module":"Typography","submodule":"Attributes"},{"file":"src/typography/attributes.js","line":185,"description":"<p>Returns the descent of the current font at its current size. The descent\nrepresents the distance, in pixels, of the character with the longest\ndescender below the baseline.</p>\n","return":{"description":"","type":"Number"},"example":["\n<div>\n<code>\nvar base = height * 0.75;\nvar scalar = 0.8; // Different for each font\n\ntextSize(32); // Set initial text size\nvar desc = textDescent() * scalar; // Calc ascent\nline(0, base+desc, width, base+desc);\ntext(\"dp\", 0, base); // Draw text on baseline\n\ntextSize(64); // Increase text size\ndesc = textDescent() * scalar; // Recalc ascent\nline(40, base + desc, width, base + desc);\ntext(\"dp\", 40, base); // Draw text on baseline\n</code>\n</div>"],"class":"p5","module":"Typography","submodule":"Attributes"},{"file":"src/typography/attributes.js","line":213,"description":"<p>Helper function to measure ascent and descent.</p>\n","class":"p5","module":"Typography","submodule":"Attributes"},{"file":"src/typography/loading_displaying.js","line":16,"description":"<p>Draws text to the screen. Displays the information specified in the first\nparameter on the screen in the position specified by the additional\nparameters. A default font will be used unless a font is set with the\ntextFont() function and a default size will be used unless a font is set\nwith textSize(). Change the color of the text with the fill() function.\nChange the outline of the text with the stroke() and strokeWeight()\nfunctions.\n<br><br>\nThe text displays in relation to the textAlign() function, which gives the\noption to draw to the left, right, and center of the coordinates.\n<br><br>\nThe x2 and y2 parameters define a rectangular area to display within and\nmay only be used with string data. When these parameters are specified,\nthey are interpreted based on the current rectMode() setting. Text that\ndoes not fit completely within the rectangle specified will not be drawn\nto the screen.</p>\n","itemtype":"method","name":"text","params":[{"name":"str","description":"<p>the alphanumeric symbols to be displayed</p>\n","type":"String"},{"name":"x","description":"<p>x-coordinate of text</p>\n","type":"Number"},{"name":"y","description":"<p>y-coordinate of text</p>\n","type":"Number"},{"name":"x2","description":"<p>by default, the width of the text box,\n see rectMode() for more info</p>\n","type":"Number"},{"name":"y2","description":"<p>by default, the height of the text box,\n see rectMode() for more info</p>\n","type":"Number"}],"return":{"description":"this","type":"Object"},"example":["\n<div>\n<code>\ntextSize(32);\ntext(\"word\", 10, 30);\nfill(0, 102, 153);\ntext(\"word\", 10, 60);\nfill(0, 102, 153, 51);\ntext(\"word\", 10, 90);\n</code>\n</div>\n<div>\n<code>\ns = \"The quick brown fox jumped over the lazy dog.\";\nfill(50);\ntext(s, 10, 10, 70, 80); // Text wraps within text box\n</code>\n</div>"],"class":"p5","module":"Typography","submodule":"Loading & Displaying"},{"file":"src/typography/loading_displaying.js","line":80,"description":"<p>Sets the current font that will be drawn with the text() function.</p>\n","itemtype":"method","name":"textFont","params":[{"name":"f","description":"<p>a font loaded via loadFont(), or a String\n representing a browser-based default font.</p>\n","type":"Object|String"}],"return":{"description":"this","type":"Object"},"example":["\n<div>\n<code>\nfill(0);\ntextSize(12);\ntextFont(\"Georgia\");\ntext(\"Georgia\", 12, 30);\ntextFont(\"Helvetica\");\ntext(\"Helvetica\", 12, 60);\n</code>\n</div>\n<div>\n<code>\nvar fontRegular, fontItalic, fontBold;\nfunction preload() {\n fontRegular = loadFont(\"assets/Regular.otf\");\n fontItalic = loadFont(\"assets/Italic.ttf\");\n fontBold = loadFont(\"assets/Bold.ttf\");\n}\nfunction setup() {\n background(210);\n fill(0).strokeWeight(0).textSize(10);\n textFont(fontRegular);\n text(\"Font Style Normal\", 10, 30);\n textFont(fontItalic);\n text(\"Font Style Italic\", 10, 50);\n textFont(fontBold);\n text(\"Font Style Bold\", 10, 70);\n}\n</code>\n</div>"],"class":"p5","module":"Typography","submodule":"Loading & Displaying"},{"file":"src/typography/p5.Font.js","line":44,"description":"<p>Underlying opentype font implementation</p>\n","itemtype":"property","name":"font","class":"p5.Font","module":"Typography","submodule":"Font"},{"file":"src/typography/p5.Font.js","line":57,"description":"<p>Returns a tight bounding box for the given text string using this\nfont (currently only supports single lines)</p>\n","itemtype":"method","name":"textBounds","params":[{"name":"line","description":"<p>a line of text</p>\n","type":"String"},{"name":"x","description":"<p>x-position</p>\n","type":"Number"},{"name":"y","description":"<p>y-position</p>\n","type":"Number"},{"name":"fontSize","description":"<p>font size to use (optional)</p>\n","type":"Number"},{"name":"options","description":"<p>opentype options (optional)</p>\n","type":"Object"}],"return":{"description":"a rectangle object with properties: x, y, w, h","type":"Object"},"example":["\n<div>\n<code>\nvar font;\nvar textString = 'Lorem ipsum dolor sit amet.';\nfunction preload() {\n font = loadFont('./assets/Regular.otf');\n};\nfunction setup() {\n background(210);\n\n var bbox = font.textBounds(textString, 10, 30, 12);\n fill(255);\n stroke(0);\n rect(bbox.x, bbox.y, bbox.w, bbox.h);\n fill(0);\n noStroke();\n\n textFont(font);\n textSize(12);\n text(textString, 10, 30);\n};\n</code>\n</div>"],"class":"p5.Font","module":"Typography","submodule":"Font"},{"file":"src/typography/p5.Font.js","line":171,"description":"<p>Computes an array of points following the path for specified text</p>\n","params":[{"name":"txt","description":"<p>a line of text</p>\n","type":"String"},{"name":"x","description":"<p>x-position</p>\n","type":"Number"},{"name":"y","description":"<p>y-position</p>\n","type":"Number"},{"name":"fontSize","description":"<p>font size to use (optional)</p>\n","type":"Number"},{"name":"options","description":"<p>an (optional) object that can contain:</p>\n<p><br>sampleFactor - the ratio of path-length to number of samples\n(default=.25); higher values yield more points and are therefore\nmore precise</p>\n<p><br>simplifyThreshold - if set to a non-zero value, collinear points will be\nbe removed from the polygon; the value represents the threshold angle to use\nwhen determining whether two edges are collinear</p>\n","type":"Object"}],"return":{"description":"an array of points, each with x, y, alpha (the path angle)","type":"Array"},"class":"p5.Font","module":"Typography","submodule":"Font"},{"file":"src/typography/p5.Font.js","line":219,"description":"<p>Returns the set of opentype glyphs for the supplied string.</p>\n<p>Note that there is not a strict one-to-one mapping between characters\nand glyphs, so the list of returned glyphs can be larger or smaller\n than the length of the given string.</p>\n","params":[{"name":"str","description":"<p>the string to be converted</p>\n","type":"String"}],"return":{"description":"the opentype glyphs","type":"Array"},"class":"p5.Font","module":"Typography","submodule":"Font"},{"file":"src/typography/p5.Font.js","line":234,"description":"<p>Returns an opentype path for the supplied string and position.</p>\n","params":[{"name":"line","description":"<p>a line of text</p>\n","type":"String"},{"name":"x","description":"<p>x-position</p>\n","type":"Number"},{"name":"y","description":"<p>y-position</p>\n","type":"Number"},{"name":"options","description":"<p>opentype options (optional)</p>\n","type":"Object"}],"return":{"description":"the opentype path","type":"Object"},"class":"p5.Font","module":"Typography","submodule":"Font"},{"file":"src/utilities/array_functions.js","line":12,"description":"<p>Adds a value to the end of an array. Extends the length of\nthe array by one. Maps to Array.push().</p>\n","itemtype":"method","name":"append","params":[{"name":"array","description":"<p>Array to append</p>\n","type":"Array"},{"name":"value","description":"<p>to be added to the Array</p>\n","type":"Any"}],"example":["\n<div class = \"norender\"><code>\nfunction setup() {\n\nvar myArray = new Array(\"Mango\", \"Apple\", \"Papaya\")\nprintln(myArray) // [\"Mango\", \"Apple\", \"Papaya\"]\n\nappend(myArray, \"Peach\")\nprintln(myArray) // [\"Mango\", \"Apple\", \"Papaya\", \"Peach\"]\n\n}\n</div></code>"],"class":"p5","module":"Data","submodule":"Array Functions"},{"file":"src/utilities/array_functions.js","line":37,"description":"<p>Copies an array (or part of an array) to another array. The src array is\ncopied to the dst array, beginning at the position specified by\nsrcPosition and into the position specified by dstPosition. The number of\nelements to copy is determined by length. Note that copying values\noverwrites existing values in the destination array. To append values\ninstead of overwriting them, use concat().\n<br><br>\nThe simplified version with only two arguments, arrayCopy(src, dst),\ncopies an entire array to another of the same size. It is equivalent to\narrayCopy(src, 0, dst, 0, src.length).\n<br><br>\nUsing this function is far more efficient for copying array data than\niterating through a for() loop and copying each element individually.</p>\n","itemtype":"method","name":"arrayCopy","params":[{"name":"src","description":"<p>the source Array</p>\n","type":"Array"},{"name":"srcPosition","description":"<p>starting position in the source Array</p>\n","type":"Number","optional":true},{"name":"dst","description":"<p>the destination Array</p>\n","type":"Array"},{"name":"dstPosition","description":"<p>starting position in the destination Array</p>\n","type":"Number","optional":true},{"name":"length","description":"<p>number of Array elements to be copied</p>\n","type":"Number","optional":true}],"example":["\n <div class=\"norender\"><code>\n function setup() {\n\n var src = new Array(\"A\", \"B\", \"C\");\n var dst = new Array( 1 , 2 , 3 );\n var srcPosition = 1;\n var dstPosition = 0;\n var length = 2;\n\n println(src); // [\"A\", \"B\", \"C\"]\n println(dst); // [ 1 , 2 , 3 ]\n\n arrayCopy(src, srcPosition, dst, dstPosition, length);\n println(dst); // [\"B\", \"C\", 3]\n\n }\n </div></code>"],"class":"p5","module":"Data","submodule":"Array Functions"},{"file":"src/utilities/array_functions.js","line":118,"description":"<p>Concatenates two arrays, maps to Array.concat(). Does not modify the\ninput arrays.</p>\n","itemtype":"method","name":"concat","params":[{"name":"a","description":"<p>first Array to concatenate</p>\n","type":"Array"},{"name":"b","description":"<p>second Array to concatenate</p>\n","type":"Array"}],"return":{"description":"concatenated array","type":"Array"},"example":["\n<div class = \"norender\"><code>\nfunction setup() {\n var arr1 = new Array(\"A\", \"B\", \"C\");\n var arr2 = new Array( 1 , 2 , 3 );\n\n println(arr1); // [\"A\",\"B\",\"C\"]\n println(arr2); // [1,2,3]\n\n var arr3 = concat(arr1, arr2);\n\n println(arr1); // [\"A\",\"B\",\"C\"]\n println(arr2); // [1,2,3]\n println(arr3); // [\"A\",\"B\",\"C\",1,2,3]\n\n}\n</div></code>"],"class":"p5","module":"Data","submodule":"Array Functions"},{"file":"src/utilities/array_functions.js","line":149,"description":"<p>Reverses the order of an array, maps to Array.reverse()</p>\n","itemtype":"method","name":"reverse","params":[{"name":"list","description":"<p>Array to reverse</p>\n","type":"Array"}],"example":["\n<div class=\"norender\"><code>\nfunction setup() {\n var myArray = new Array(\"A\", \"B\", \"C\");\n println(myArray); // [\"A\",\"B\",\"C\"]\n\n reverse(myArray);\n println(myArray); // [\"C\",\"B\",\"A\"]\n}\n</div></code>"],"class":"p5","module":"Data","submodule":"Array Functions"},{"file":"src/utilities/array_functions.js","line":169,"description":"<p>Decreases an array by one element and returns the shortened array,\nmaps to Array.pop().</p>\n","itemtype":"method","name":"shorten","params":[{"name":"list","description":"<p>Array to shorten</p>\n","type":"Array"}],"return":{"description":"shortened Array","type":"Array"},"example":["\n<div class = \"norender\"><code>\nfunction setup() {\n var myArray = new Array(\"A\", \"B\", \"C\");\n println(myArray); // [\"A\",\"B\",\"C\"]\n\n var newArray = shorten(myArray);\n println(myArray); // [\"A\",\"B\",\"C\"]\n println(newArray); // [\"A\",\"B\"]\n}\n</div></code>"],"class":"p5","module":"Data","submodule":"Array Functions"},{"file":"src/utilities/array_functions.js","line":193,"description":"<p>Randomizes the order of the elements of an array. Implements\n<a href=\"http://Bost.Ocks.org/mike/shuffle/\" target=_blank>\nFisher-Yates Shuffle Algorithm</a>.</p>\n","itemtype":"method","name":"shuffle","params":[{"name":"array","description":"<p>Array to shuffle</p>\n","type":"Array"},{"name":"bool","description":"<p>modify passed array</p>\n","type":"Boolean","optional":true}],"return":{"description":"shuffled Array","type":"Array"},"example":["\n<div><code>\nfunction setup() {\n var regularArr = ['ABC', 'def', createVector(), TAU, Math.E];\n println(regularArr);\n shuffle(regularArr, true); // force modifications to passed array\n println(regularArr);\n\n // By default shuffle() returns a shuffled cloned array:\n var newArr = shuffle(regularArr);\n println(regularArr);\n println(newArr);\n}\n</code></div>"],"class":"p5","module":"Data","submodule":"Array Functions"},{"file":"src/utilities/array_functions.js","line":233,"description":"<p>Sorts an array of numbers from smallest to largest, or puts an array of\nwords in alphabetical order. The original array is not modified; a\nre-ordered array is returned. The count parameter states the number of\nelements to sort. For example, if there are 12 elements in an array and\ncount is set to 5, only the first 5 elements in the array will be sorted.</p>\n","itemtype":"method","name":"sort","params":[{"name":"list","description":"<p>Array to sort</p>\n","type":"Array"},{"name":"count","description":"<p>number of elements to sort, starting from 0</p>\n","type":"Number","optional":true}],"example":["\n<div class = \"norender\"><code>\nfunction setup() {\n var words = new Array(\"banana\", \"apple\", \"pear\",\"lime\");\n println(words); // [\"banana\", \"apple\", \"pear\", \"lime\"]\n var count = 4; // length of array\n\n words = sort(words, count);\n println(words); // [\"apple\", \"banana\", \"lime\", \"pear\"]\n}\n</div></code>\n<div class = \"norender\"><code>\nfunction setup() {\n var numbers = new Array(2,6,1,5,14,9,8,12);\n println(numbers); // [2,6,1,5,14,9,8,12]\n var count = 5; // Less than the length of the array\n\n numbers = sort(numbers, count);\n println(numbers); // [1,2,5,6,14,9,8,12]\n}\n</div></code>"],"class":"p5","module":"Data","submodule":"Array Functions"},{"file":"src/utilities/array_functions.js","line":277,"description":"<p>Inserts a value or an array of values into an existing array. The first\nparameter specifies the initial array to be modified, and the second\nparameter defines the data to be inserted. The third parameter is an index\nvalue which specifies the array position from which to insert data.\n(Remember that array index numbering starts at zero, so the first position\nis 0, the second position is 1, and so on.)</p>\n","itemtype":"method","name":"splice","params":[{"name":"list","description":"<p>Array to splice into</p>\n","type":"Array"},{"name":"value","description":"<p>value to be spliced in</p>\n","type":"Any"},{"name":"position","description":"<p>in the array from which to insert data</p>\n","type":"Number"}],"example":["\n<div class = \"norender\"><code>\nfunction setup() {\n var myArray = new Array(0,1,2,3,4);\n var insArray = new Array(\"A\",\"B\",\"C\");\n println(myArray); // [0,1,2,3,4]\n println(insArray); // [\"A\",\"B\",\"C\"]\n\n splice(myArray, insArray, 3);\n println(myArray); // [0,1,2,\"A\",\"B\",\"C\",3,4]\n}\n</div></code>"],"class":"p5","module":"Data","submodule":"Array Functions"},{"file":"src/utilities/array_functions.js","line":311,"description":"<p>Extracts an array of elements from an existing array. The list parameter\ndefines the array from which the elements will be copied, and the start\nand count parameters specify which elements to extract. If no count is\ngiven, elements will be extracted from the start to the end of the array.\nWhen specifying the start, remember that the first array element is 0.\nThis function does not change the source array.</p>\n","itemtype":"method","name":"subset","params":[{"name":"list","description":"<p>Array to extract from</p>\n","type":"Array"},{"name":"start","description":"<p>position to begin</p>\n","type":"Number"},{"name":"count","description":"<p>number of values to extract</p>\n","type":"Number","optional":true}],"return":{"description":"Array of extracted elements","type":"Array"},"example":["\n<div class = \"norender\"><code>\nfunction setup() {\n var myArray = new Array(1,2,3,4,5);\n println(myArray); // [1,2,3,4,5]\n\n var sub1 = subset(myArray, 0, 3);\n var sub2 = subset(myArray, 2, 2);\n println(sub1); // [1,2,3]\n println(sub2); // [3,4]\n}\n</div></code>"],"class":"p5","module":"Data","submodule":"Array Functions"},{"file":"src/utilities/conversion.js","line":12,"description":"<p>Converts a string to its floating point representation. The contents of a\nstring must resemble a number, or NaN (not a number) will be returned.\nFor example, float(&quot;1234.56&quot;) evaluates to 1234.56, but float(&quot;giraffe&quot;)\nwill return NaN.</p>\n","itemtype":"method","name":"float","params":[{"name":"str","description":"<p>float string to parse</p>\n","type":"String"}],"return":{"description":"floating point representation of string","type":"Number"},"example":["\n<div><code>\nvar str = '20';\nvar diameter = float(str);\nellipse(width/2, height/2, diameter, diameter);\n</code></div>"],"class":"p5","module":"Data","submodule":"Conversion"},{"file":"src/utilities/conversion.js","line":32,"description":"<p>Converts a boolean, string, or float to its integer representation.\nWhen an array of values is passed in, then an int array of the same length\nis returned.</p>\n","itemtype":"method","name":"int","params":[{"name":"n","description":"<p>value to parse</p>\n","type":"String|Boolean|Number|Array"}],"return":{"description":"integer representation of value","type":"Number"},"example":["\n<div class='norender'><code>\nprintln(int(\"10\")); // 10\nprintln(int(10.31)); // 10\nprintln(int(-10)); // -10\nprintln(int(true)); // 1\nprintln(int(false)); // 0\nprintln(int([false, true, \"10.3\", 9.8])); // [0, 1, 10, 9]\n</code></div>"],"class":"p5","module":"Data","submodule":"Conversion"},{"file":"src/utilities/conversion.js","line":63,"description":"<p>Converts a boolean, string or number to its string representation.\nWhen an array of values is passed in, then an array of strings of the same\nlength is returned.</p>\n","itemtype":"method","name":"str","params":[{"name":"n","description":"<p>value to parse</p>\n","type":"String|Boolean|Number|Array"}],"return":{"description":"string representation of value","type":"String"},"example":["\n<div class='norender'><code>\nprintln(str(\"10\")); // \"10\"\nprintln(str(10.31)); // \"10.31\"\nprintln(str(-10)); // \"-10\"\nprintln(str(true)); // \"true\"\nprintln(str(false)); // \"false\"\nprintln(str([true, \"10.3\", 9.8])); // [ \"true\", \"10.3\", \"9.8\" ]\n</code></div>"],"class":"p5","module":"Data","submodule":"Conversion"},{"file":"src/utilities/conversion.js","line":89,"description":"<p>Converts a number or string to its boolean representation.\nFor a number, any non-zero value (positive or negative) evaluates to true,\nwhile zero evaluates to false. For a string, the value &quot;true&quot; evaluates to\ntrue, while any other value evaluates to false. When an array of number or\nstring values is passed in, then a array of booleans of the same length is\nreturned.</p>\n","itemtype":"method","name":"boolean","params":[{"name":"n","description":"<p>value to parse</p>\n","type":"String|Boolean|Number|Array"}],"return":{"description":"boolean representation of value","type":"Boolean"},"example":["\n<div class='norender'><code>\nprintln(boolean(0)); // false\nprintln(boolean(1)); // true\nprintln(boolean(\"true\")); // true\nprintln(boolean(\"abcd\")); // false\nprintln(boolean([0, 12, \"true\"])); // [false, true, false]\n</code></div>"],"class":"p5","module":"Data","submodule":"Conversion"},{"file":"src/utilities/conversion.js","line":121,"description":"<p>Converts a number, string or boolean to its byte representation.\nA byte can be only a whole number between -128 and 127, so when a value\noutside of this range is converted, it wraps around to the corresponding\nbyte representation. When an array of number, string or boolean values is\npassed in, then an array of bytes the same length is returned.</p>\n","itemtype":"method","name":"byte","params":[{"name":"n","description":"<p>value to parse</p>\n","type":"String|Boolean|Number|Array"}],"return":{"description":"byte representation of value","type":"Number"},"example":["\n<div class='norender'><code>\nprintln(byte(127)); // 127\nprintln(byte(128)); // -128\nprintln(byte(23.4)); // 23\nprintln(byte(\"23.4\")); // 23\nprintln(byte(true)); // 1\nprintln(byte([0, 255, \"100\"])); // [0, -1, 100]\n</code></div>"],"class":"p5","module":"Data","submodule":"Conversion"},{"file":"src/utilities/conversion.js","line":150,"description":"<p>Converts a number or string to its corresponding single-character\nstring representation. If a string parameter is provided, it is first\nparsed as an integer and then translated into a single-character string.\nWhen an array of number or string values is passed in, then an array of\nsingle-character strings of the same length is returned.</p>\n","itemtype":"method","name":"char","params":[{"name":"n","description":"<p>value to parse</p>\n","type":"String|Number|Array"}],"return":{"description":"string representation of value","type":"String"},"example":["\n<div class='norender'><code>\nprintln(char(65)); // \"A\"\nprintln(char(\"65\")); // \"A\"\nprintln(char([65, 66, 67])); // [ \"A\", \"B\", \"C\" ]\nprintln(join(char([65, 66, 67]), '')); // \"ABC\"\n</code></div>"],"class":"p5","module":"Data","submodule":"Conversion"},{"file":"src/utilities/conversion.js","line":178,"description":"<p>Converts a single-character string to its corresponding integer\nrepresentation. When an array of single-character string values is passed\nin, then an array of integers of the same length is returned.</p>\n","itemtype":"method","name":"unchar","params":[{"name":"n","description":"<p>value to parse</p>\n","type":"String|Array"}],"return":{"description":"integer representation of value","type":"Number"},"example":["\n<div class='norender'><code>\nprintln(unchar(\"A\")); // 65\nprintln(unchar([\"A\", \"B\", \"C\"])); // [ 65, 66, 67 ]\nprintln(unchar(split(\"ABC\", \"\"))); // [ 65, 66, 67 ]\n</code></div>"],"class":"p5","module":"Data","submodule":"Conversion"},{"file":"src/utilities/conversion.js","line":201,"description":"<p>Converts a number to a string in its equivalent hexadecimal notation. If a\nsecond parameter is passed, it is used to set the number of characters to\ngenerate in the hexadecimal notation. When an array is passed in, an\narray of strings in hexadecimal notation of the same length is returned.</p>\n","itemtype":"method","name":"hex","params":[{"name":"n","description":"<p>value to parse</p>\n","type":"Number|Array"}],"return":{"description":"hexadecimal string representation of value","type":"String"},"example":["\n<div class='norender'><code>\nprintln(hex(255)); // \"000000FF\"\nprintln(hex(255, 6)); // \"0000FF\"\nprintln(hex([0, 127, 255], 6)); // [ \"000000\", \"00007F\", \"0000FF\" ]\n</code></div>"],"class":"p5","module":"Data","submodule":"Conversion"},{"file":"src/utilities/conversion.js","line":236,"description":"<p>Converts a string representation of a hexadecimal number to its equivalent\ninteger value. When an array of strings in hexadecimal notation is passed\nin, an array of integers of the same length is returned.</p>\n","itemtype":"method","name":"unhex","params":[{"name":"n","description":"<p>value to parse</p>\n","type":"String|Array"}],"return":{"description":"integer representation of hexadecimal value","type":"Number"},"example":["\n<div class='norender'><code>\nprintln(unhex(\"A\")); // 10\nprintln(unhex(\"FF\")); // 255\nprintln(unhex([\"FF\", \"AA\", \"00\"])); // [ 255, 170, 0 ]\n</code></div>"],"class":"p5","module":"Data","submodule":"Conversion"},{"file":"src/utilities/string_functions.js","line":14,"description":"<p>Combines an array of Strings into one String, each separated by the\ncharacter(s) used for the separator parameter. To join arrays of ints or\nfloats, it&#39;s necessary to first convert them to Strings using nf() or\nnfs().</p>\n","itemtype":"method","name":"join","params":[{"name":"list","description":"<p>array of Strings to be joined</p>\n","type":"Array"},{"name":"separator","description":"<p>String to be placed between each item</p>\n","type":"String"}],"return":{"description":"joined String","type":"String"},"example":["\n<div>\n<code>\nvar array = [\"Hello\", \"world!\"]\nvar separator = \" \"\nvar message = join(array, separator);\ntext(message, 5, 50);\n</code>\n</div>"],"class":"p5","module":"Data","submodule":"String Functions"},{"file":"src/utilities/string_functions.js","line":38,"description":"<p>This function is used to apply a regular expression to a piece of text,\nand return matching groups (elements found inside parentheses) as a\nString array. If there are no matches, a null value will be returned.\nIf no groups are specified in the regular expression, but the sequence\nmatches, an array of length 1 (with the matched text as the first element\nof the array) will be returned.\n<br><br>\nTo use the function, first check to see if the result is null. If the\nresult is null, then the sequence did not match at all. If the sequence\ndid match, an array is returned.\n<br><br>\nIf there are groups (specified by sets of parentheses) in the regular\nexpression, then the contents of each will be returned in the array.\nElement [0] of a regular expression match returns the entire matching\nstring, and the match groups start at element [1] (the first group is [1],\nthe second [2], and so on).</p>\n","itemtype":"method","name":"match","params":[{"name":"str","description":"<p>the String to be searched</p>\n","type":"String"},{"name":"regexp","description":"<p>the regexp to be used for matching</p>\n","type":"String"}],"return":{"description":"Array of Strings found","type":"Array"},"example":["\n<div>\n<code>\nvar string = \"Hello p5js*!\"\nvar regexp = \"p5js\\\\*\"\nvar match = match(string, regexp);\ntext(match, 5, 50);\n</code>\n</div>"],"class":"p5","module":"Data","submodule":"String Functions"},{"file":"src/utilities/string_functions.js","line":74,"description":"<p>This function is used to apply a regular expression to a piece of text,\nand return a list of matching groups (elements found inside parentheses)\nas a two-dimensional String array. If there are no matches, a null value\nwill be returned. If no groups are specified in the regular expression,\nbut the sequence matches, a two dimensional array is still returned, but\nthe second dimension is only of length one.\n<br><br>\nTo use the function, first check to see if the result is null. If the\nresult is null, then the sequence did not match at all. If the sequence\ndid match, a 2D array is returned.\n<br><br>\nIf there are groups (specified by sets of parentheses) in the regular\nexpression, then the contents of each will be returned in the array.\nAssuming a loop with counter variable i, element [i][0] of a regular\nexpression match returns the entire matching string, and the match groups\nstart at element [i][1] (the first group is [i][1], the second [i][2],\nand so on).</p>\n","itemtype":"method","name":"matchAll","params":[{"name":"str","description":"<p>the String to be searched</p>\n","type":"String"},{"name":"regexp","description":"<p>the regexp to be used for matching</p>\n","type":"String"}],"return":{"description":"2d Array of Strings found","type":"Array"},"example":["\n<div class=\"norender\">\n<code>\nvar string = \"Hello p5js*! Hello world!\"\nvar regexp = \"Hello\"\nmatchAll(string, regexp);\n</code>\n</div>\n"],"class":"p5","module":"Data","submodule":"String Functions"},{"file":"src/utilities/string_functions.js","line":121,"description":"<p>Utility function for formatting numbers into strings. There are two\nversions: one for formatting floats, and one for formatting ints.\nThe values for the digits, left, and right parameters should always\nbe positive integers.</p>\n","itemtype":"method","name":"nf","params":[{"name":"num","description":"<p>the Number to format</p>\n","type":"Number|Array"},{"name":"left","description":"<p>number of digits to the left of the\n decimal point</p>\n","type":"Number","optional":true},{"name":"right","description":"<p>number of digits to the right of the\n decimal point</p>\n","type":"Number","optional":true}],"return":{"description":"formatted String","type":"String|Array"},"example":["\n<div>\n<code>\nfunction setup() {\n background(200);\n var num = 112.53106115;\n\n noStroke();\n fill(0);\n textSize(14);\n // Draw formatted numbers\n text(nf(num, 5, 2), 10, 20);\n\n text(nf(num, 4, 3), 10, 55);\n\n text(nf(num, 3, 6), 10, 85);\n\n // Draw dividing lines\n stroke(120);\n line(0, 30, width, 30);\n line(0, 65, width, 65);\n}\n</code>\n</div>"],"class":"p5","module":"Data","submodule":"String Functions"},{"file":"src/utilities/string_functions.js","line":222,"description":"<p>Utility function for formatting numbers into strings and placing\nappropriate commas to mark units of 1000. There are two versions: one\nfor formatting ints, and one for formatting an array of ints. The value\nfor the right parameter should always be a positive integer.</p>\n","itemtype":"method","name":"nfc","params":[{"name":"num","description":"<p>the Number to format</p>\n","type":"Number|Array"},{"name":"right","description":"<p>number of digits to the right of the\n decimal point</p>\n","type":"Number","optional":true}],"return":{"description":"formatted String","type":"String|Array"},"example":["\n<div>\n<code>\nfunction setup() {\n background(200);\n var num = 11253106.115;\n var numArr = new Array(1,1,2);\n\n noStroke();\n fill(0);\n textSize(12);\n\n // Draw formatted numbers\n text(nfc(num, 4, 2), 10, 30);\n text(nfc(numArr, 2, 1), 10, 80);\n\n // Draw dividing line\n stroke(120);\n line(0, 50, width, 50);\n}\n</code>\n</div>"],"class":"p5","module":"Data","submodule":"String Functions"},{"file":"src/utilities/string_functions.js","line":290,"description":"<p>Utility function for formatting numbers into strings. Similar to nf() but\nputs a &quot;+&quot; in front of positive numbers and a &quot;-&quot; in front of negative\nnumbers. There are two versions: one for formatting floats, and one for\nformatting ints. The values for left, and right parameters\nshould always be positive integers.</p>\n","itemtype":"method","name":"nfp","params":[{"name":"num","description":"<p>the Number to format</p>\n","type":"Number|Array"},{"name":"left","description":"<p>number of digits to the left of the decimal\n point</p>\n","type":"Number","optional":true},{"name":"right","description":"<p>number of digits to the right of the\n decimal point</p>\n","type":"Number","optional":true}],"return":{"description":"formatted String","type":"String|Array"},"example":["\n<div>\n<code>\nfunction setup() {\n background(200);\n var num1 = 11253106.115;\n var num2 = -11253106.115;\n\n noStroke();\n fill(0);\n textSize(12);\n\n // Draw formatted numbers\n text(nfp(num1, 4, 2), 10, 30);\n text(nfp(num2, 4, 2), 10, 80);\n\n // Draw dividing line\n stroke(120);\n line(0, 50, width, 50);\n}\n</code>\n</div>"],"class":"p5","module":"Data","submodule":"String Functions"},{"file":"src/utilities/string_functions.js","line":343,"description":"<p>Utility function for formatting numbers into strings. Similar to nf() but\nputs a &quot; &quot; (space) in front of positive numbers and a &quot;-&quot; in front of\nnegative numbers. There are two versions: one for formatting floats, and\none for formatting ints. The values for the digits, left, and right\nparameters should always be positive integers.</p>\n","itemtype":"method","name":"nfs","params":[{"name":"num","description":"<p>the Number to format</p>\n","type":"Number|Array"},{"name":"left","description":"<p>number of digits to the left of the decimal\n point</p>\n","type":"Number","optional":true},{"name":"right","description":"<p>number of digits to the right of the\n decimal point</p>\n","type":"Number","optional":true}],"return":{"description":"formatted String","type":"String|Array"},"example":["\n<div>\n<code>\nfunction setup() {\n background(200);\n var num1 = 11253106.115;\n var num2 = -11253106.115;\n\n noStroke();\n fill(0);\n textSize(12);\n // Draw formatted numbers\n text(nfs(num1, 4, 2), 10, 30);\n\n text(nfs(num2, 4, 2), 10, 80);\n\n // Draw dividing line\n stroke(120);\n line(0, 50, width, 50);\n}\n</code>\n</div>"],"class":"p5","module":"Data","submodule":"String Functions"},{"file":"src/utilities/string_functions.js","line":396,"description":"<p>The split() function maps to String.split(), it breaks a String into\npieces using a character or string as the delimiter. The delim parameter\nspecifies the character or characters that mark the boundaries between\neach piece. A String[] array is returned that contains each of the pieces.</p>\n<p>The splitTokens() function works in a similar fashion, except that it\nsplits using a range of characters instead of a specific character or\nsequence.</p>\n","itemtype":"method","name":"split","params":[{"name":"value","description":"<p>the String to be split</p>\n","type":"String"},{"name":"delim","description":"<p>the String used to separate the data</p>\n","type":"String"}],"return":{"description":"Array of Strings","type":"Array"},"example":["\n<div>\n<code>\nvar names = \"Pat,Xio,Alex\"\nvar splitString = split(names, \",\");\ntext(splitString[0], 5, 30);\ntext(splitString[1], 5, 50);\ntext(splitString[2], 5, 70);\n</code>\n</div>"],"class":"p5","module":"Data","submodule":"String Functions"},{"file":"src/utilities/string_functions.js","line":425,"description":"<p>The splitTokens() function splits a String at one or many character\ndelimiters or &quot;tokens.&quot; The delim parameter specifies the character or\ncharacters to be used as a boundary.\n<br><br>\nIf no delim characters are specified, any whitespace character is used to\nsplit. Whitespace characters include tab (\\t), line feed (\\n), carriage\nreturn (\\r), form feed (\\f), and space.</p>\n","itemtype":"method","name":"splitTokens","params":[{"name":"value","description":"<p>the String to be split</p>\n","type":"String"},{"name":"delim","description":"<p>list of individual Strings that will be used as\n separators</p>\n","type":"String","optional":true}],"return":{"description":"Array of Strings","type":"Array"},"example":["\n<div class = \"norender\">\n<code>\nfunction setup() {\n var myStr = \"Mango, Banana, Lime\";\n var myStrArr = splitTokens(myStr, \",\");\n\n println(myStrArr); // prints : [\"Mango\",\" Banana\",\" Lime\"]\n}\n</code>\n</div>"],"class":"p5","module":"Data","submodule":"String Functions"},{"file":"src/utilities/string_functions.js","line":477,"description":"<p>Removes whitespace characters from the beginning and end of a String. In\naddition to standard whitespace characters such as space, carriage return,\nand tab, this function also removes the Unicode &quot;nbsp&quot; character.</p>\n","itemtype":"method","name":"trim","params":[{"name":"str","description":"<p>a String or Array of Strings to be trimmed</p>\n","type":"String|Array"}],"return":{"description":"a trimmed String or Array of Strings","type":"String|Array"},"example":["\n<div>\n<code>\nvar string = trim(\" No new lines\\n \");\ntext(string +\" here\", 2, 50);\n</code>\n</div>"],"class":"p5","module":"Data","submodule":"String Functions"},{"file":"src/utilities/time_date.js","line":12,"description":"<p>p5.js communicates with the clock on your computer. The day() function\nreturns the current day as a value from 1 - 31.</p>\n","itemtype":"method","name":"day","return":{"description":"the current day","type":"Number"},"example":["\n<div>\n<code>\nvar d = day();\ntext(\"Current day: \\n\" + d, 5, 50);\n</code>\n</div>"],"class":"p5","module":"IO","submodule":"Time & Date"},{"file":"src/utilities/time_date.js","line":30,"description":"<p>p5.js communicates with the clock on your computer. The hour() function\nreturns the current hour as a value from 0 - 23.</p>\n","itemtype":"method","name":"hour","return":{"description":"the current hour","type":"Number"},"example":["\n<div>\n<code>\nvar h = hour();\ntext(\"Current hour:\\n\" + h, 5, 50);\n</code>\n</div>"],"class":"p5","module":"IO","submodule":"Time & Date"},{"file":"src/utilities/time_date.js","line":48,"description":"<p>p5.js communicates with the clock on your computer. The minute() function\nreturns the current minute as a value from 0 - 59.</p>\n","itemtype":"method","name":"minute","return":{"description":"the current minute","type":"Number"},"example":["\n<div>\n<code>\nvar m = minute();\ntext(\"Current minute: \\n\" + m, 5, 50);\n</code>\n</div>"],"class":"p5","module":"IO","submodule":"Time & Date"},{"file":"src/utilities/time_date.js","line":66,"description":"<p>Returns the number of milliseconds (thousandths of a second) since\nstarting the program. This information is often used for timing events and\nanimation sequences.</p>\n","itemtype":"method","name":"millis","return":{"description":"the number of milliseconds since starting the program","type":"Number"},"example":["\n<div>\n<code>\nvar millisecond = millis();\ntext(\"Milliseconds \\nrunning: \\n\" + millisecond, 5, 40);\n</code>\n</div>"],"class":"p5","module":"IO","submodule":"Time & Date"},{"file":"src/utilities/time_date.js","line":85,"description":"<p>p5.js communicates with the clock on your computer. The month() function\nreturns the current month as a value from 1 - 12.</p>\n","itemtype":"method","name":"month","return":{"description":"the current month","type":"Number"},"example":["\n<div>\n<code>\nvar m = month();\ntext(\"Current month: \\n\" + m, 5, 50);\n</code>\n</div>"],"class":"p5","module":"IO","submodule":"Time & Date"},{"file":"src/utilities/time_date.js","line":103,"description":"<p>p5.js communicates with the clock on your computer. The second() function\nreturns the current second as a value from 0 - 59.</p>\n","itemtype":"method","name":"second","return":{"description":"the current second","type":"Number"},"example":["\n<div>\n<code>\nvar s = second();\ntext(\"Current second: \\n\" + s, 5, 50);\n</code>\n</div>"],"class":"p5","module":"IO","submodule":"Time & Date"},{"file":"src/utilities/time_date.js","line":121,"description":"<p>p5.js communicates with the clock on your computer. The year() function\nreturns the current year as an integer (2014, 2015, 2016, etc).</p>\n","itemtype":"method","name":"year","return":{"description":"the current year","type":"Number"},"example":["\n<div>\n<code>\nvar y = year();\ntext(\"Current year: \\n\" + y, 5, 50);\n</code>\n</div>"],"class":"p5","module":"IO","submodule":"Time & Date"},{"file":"src/webgl/camera.js","line":12,"description":"<p>Sets camera position</p>\n","itemtype":"method","name":"camera","params":[{"name":"x","description":"<p>camera position value on x axis</p>\n","type":"Number"},{"name":"y","description":"<p>camera position value on y axis</p>\n","type":"Number"},{"name":"z","description":"<p>camera position value on z axis</p>\n","type":"Number"}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n}\nfunction draw(){\n //move the camera away from the plane by a sin wave\n camera(0, 0, sin(frameCount * 0.01) * 100);\n plane(120, 120);\n}\n</code>\n</div>"],"class":"p5","module":"Lights, Camera","submodule":"Camera"},{"file":"src/webgl/camera.js","line":47,"description":"<p>Sets perspective camera</p>\n","itemtype":"method","name":"perspective","params":[{"name":"fovy","description":"<p>camera frustum vertical field of view,\n from bottom to top of view, in degrees</p>\n","type":"Number"},{"name":"aspect","description":"<p>camera frustum aspect ratio</p>\n","type":"Number"},{"name":"near","description":"<p>frustum near plane length</p>\n","type":"Number"},{"name":"far","description":"<p>frustum far plane length</p>\n","type":"Number"}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\n//drag mouse to toggle the world!\n//you will see there's a vanish point\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n perspective(60 / 180 * PI, width/height, 0.1, 100);\n}\nfunction draw(){\n background(200);\n orbitControl();\n for(var i = -1; i < 2; i++){\n for(var j = -2; j < 3; j++){\n push();\n translate(i*160, 0, j*160);\n box(40, 40, 40);\n pop();\n }\n }\n}\n</code>\n</div>"],"class":"p5","module":"Lights, Camera","submodule":"Camera"},{"file":"src/webgl/camera.js","line":95,"description":"<p>Setup ortho camera</p>\n","itemtype":"method","name":"ortho","params":[{"name":"left","description":"<p>camera frustum left plane</p>\n","type":"Number"},{"name":"right","description":"<p>camera frustum right plane</p>\n","type":"Number"},{"name":"bottom","description":"<p>camera frustum bottom plane</p>\n","type":"Number"},{"name":"top","description":"<p>camera frustum top plane</p>\n","type":"Number"},{"name":"near","description":"<p>camera frustum near plane</p>\n","type":"Number"},{"name":"far","description":"<p>camera frustum far plane</p>\n","type":"Number"}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\n//drag mouse to toggle the world!\n//there's no vanish point\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n ortho(-width/2, width/2, height/2, -height/2, 0.1, 100);\n}\nfunction draw(){\n background(200);\n orbitControl();\n for(var i = -1; i < 2; i++){\n for(var j = -2; j < 3; j++){\n push();\n translate(i*160, 0, j*160);\n box(40, 40, 40);\n pop();\n }\n }\n}\n</code>\n</div>"],"class":"p5","module":"Lights, Camera","submodule":"Camera"},{"file":"src/webgl/light.js","line":12,"description":"<p>Creates an ambient light with a color</p>\n","itemtype":"method","name":"ambientLight","params":[{"name":"v1","description":"<p>gray value,\nred or hue value (depending on the current color mode),\nor color Array, or CSS color string</p>\n","type":"Number|Array|String|p5.Color"},{"name":"v2","description":"<p>optional: green or saturation value</p>\n","type":"Number","optional":true},{"name":"v3","description":"<p>optional: blue or brightness value</p>\n","type":"Number","optional":true},{"name":"a","description":"<p>optional: opacity</p>\n","type":"Number","optional":true}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n}\nfunction draw(){\n background(0);\n ambientLight(150);\n ambientMaterial(250);\n sphere(200);\n}\n</code>\n</div>"],"class":"p5","module":"Lights, Camera","submodule":"Lights"},{"file":"src/webgl/light.js","line":68,"description":"<p>Creates a directional light with a color and a direction</p>\n","itemtype":"method","name":"directionalLight","params":[{"name":"v1","description":"<p>gray value,\nred or hue value (depending on the current color mode),\nor color Array, or CSS color string</p>\n","type":"Number|Array|String|p5.Color"},{"name":"v2","description":"<p>optional: green or saturation value</p>\n","type":"Number","optional":true},{"name":"v3","description":"<p>optional: blue or brightness value</p>\n","type":"Number","optional":true},{"name":"a","description":"<p>optional: opacity</p>\n","type":"Number","optional":true},{"name":"x","description":"<p>x axis direction or a p5.Vector</p>\n","type":"Number|p5.Vector"},{"name":"y","description":"<p>optional: y axis direction</p>\n","type":"Number","optional":true},{"name":"z","description":"<p>optional: z axis direction</p>\n","type":"Number","optional":true}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n}\nfunction draw(){\n background(0);\n //move your mouse to change light direction\n var dirX = (mouseX / width - 0.5) *2;\n var dirY = (mouseY / height - 0.5) *(-2);\n directionalLight(250, 250, 250, dirX, dirY, 0.25);\n ambientMaterial(250);\n sphere(200);\n}\n</code>\n</div>"],"class":"p5","module":"Lights, Camera","submodule":"Lights"},{"file":"src/webgl/light.js","line":192,"description":"<p>Creates a point light with a color and a light position</p>\n","itemtype":"method","name":"pointLight","params":[{"name":"v1","description":"<p>gray value,\nred or hue value (depending on the current color mode),\nor color Array, or CSS color string</p>\n","type":"Number|Array|String|p5.Color"},{"name":"v2","description":"<p>optional: green or saturation value</p>\n","type":"Number","optional":true},{"name":"v3","description":"<p>optional: blue or brightness value</p>\n","type":"Number","optional":true},{"name":"a","description":"<p>optional: opacity</p>\n","type":"Number","optional":true},{"name":"x","description":"<p>x axis position or a p5.Vector</p>\n","type":"Number|p5.Vector"},{"name":"y","description":"<p>optional: y axis position</p>\n","type":"Number","optional":true},{"name":"z","description":"<p>optional: z axis position</p>\n","type":"Number","optional":true}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n}\nfunction draw(){\n background(0);\n //move your mouse to change light position\n var locY = (mouseY / height - 0.5) *(-2);\n var locX = (mouseX / width - 0.5) *2;\n //to set the light position,\n //think of the world's coordinate as:\n // -1,1 -------- 1,1\n // | |\n // | |\n // | |\n // -1,-1---------1,-1\n pointLight(250, 250, 250, locX, locY, 0);\n ambientMaterial(250);\n sphere(200);\n}\n</code>\n</div>"],"class":"p5","module":"Lights, Camera","submodule":"Lights"},{"file":"src/webgl/loading.js","line":14,"description":"<p>Load a 3d model from an OBJ file.\n<br><br>\nOne of the limitations of the OBJ format is that it doesn&#39;t have a built-in\nsense of scale. This means that models exported from different programs might\nbe very different sizes. If your model isn&#39;t displaying, try calling\nloadModel() with the normalized parameter set to true. This will resize the\nmodel to a scale appropriate for p5. You can also make additional changes to\nthe final size of your model with the scale() function.</p>\n","itemtype":"method","name":"loadModel","params":[{"name":"path","description":"<p>Path of the model to be loaded</p>\n","type":"String"},{"name":"normalize","description":"<p>If true, scale the model to a\n standardized size when loading</p>\n","type":"Boolean","optional":true},{"name":"successCallback","description":"<p>Function to be called\n once the model is loaded. Will be passed\n the 3D model object.</p>\n","type":"Function(p5.Geometry3D)","optional":true},{"name":"failureCallback","description":"<p>called with event error if\n the image fails to load.</p>\n","type":"Function(Event)","optional":true}],"return":{"description":"the p5.Geometry3D object","type":"p5.Geometry"},"example":["\n<div>\n<code>\n//draw a spinning teapot\nvar teapot;\n\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n\n teapot = loadModel('assets/teapot.obj');\n}\n\nfunction draw(){\n background(200);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n model(teapot);\n}\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"3D Models"},{"file":"src/webgl/loading.js","line":87,"description":"<p>Parse OBJ lines into model. For reference, this is what a simple model of a\nsquare might look like:</p>\n<p>v -0.5 -0.5 0.5\nv -0.5 -0.5 -0.5\nv -0.5 0.5 -0.5\nv -0.5 0.5 0.5</p>\n<p>f 4 3 2 1</p>\n","class":"p5","module":"Shape","submodule":"3D Models"},{"file":"src/webgl/loading.js","line":187,"description":"<p>Render a 3d model to the screen.</p>\n","itemtype":"method","name":"model","params":[{"name":"model","description":"<p>Loaded 3d model to be rendered</p>\n","type":"p5.Geometry"}],"example":["\n<div>\n<code>\n//draw a spinning teapot\nvar teapot;\n\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n\n teapot = loadModel('assets/teapot.obj');\n}\n\nfunction draw(){\n background(200);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n model(teapot);\n}\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"3D Models"},{"file":"src/webgl/material.js","line":13,"description":"<p>Normal material for geometry. You can view all\npossible materials in this\n<a href=\"https://p5js.org/examples/examples/3D_Materials.php\">example</a>.</p>\n","itemtype":"method","name":"normalMaterial","return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw(){\n background(0);\n normalMaterial();\n sphere(200);\n}\n</code>\n</div>"],"class":"p5","module":"Lights, Camera","submodule":"Material"},{"file":"src/webgl/material.js","line":39,"description":"<p>Texture for geometry. You can view other possible materials in this\n<a href=\"https://p5js.org/examples/examples/3D_Materials.php\">example</a>.</p>\n","itemtype":"method","name":"texture","params":[{"name":"tex","description":"<p>2-dimensional graphics\n to render as texture</p>\n","type":"p5.Image | p5.MediaElement | p5.Graphics"}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\nvar img;\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n img = loadImage(\"assets/laDefense.jpg\");\n}\n\nfunction draw(){\n background(0);\n rotateZ(frameCount * 0.01);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n //pass image as texture\n texture(img);\n box(200, 200, 200);\n}\n</code>\n</div>\n\n<div>\n<code>\nvar pg;\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n pg = createGraphics(200, 200);\n pg.textSize(100);\n}\n\nfunction draw(){\n background(0);\n pg.background(255);\n pg.text('hello!', 0, 100);\n //pass image as texture\n texture(pg);\n plane(200);\n}\n</code>\n</div>\n\n<div>\n<code>\nvar vid;\nfunction preload(){\n vid = createVideo(\"assets/fingers.mov\");\n vid.hide();\n vid.loop();\n}\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw(){\n background(0);\n //pass video frame as texture\n texture(vid);\n plane(200);\n}\n</code>\n</div>"],"class":"p5","module":"Lights, Camera","submodule":"Material"},{"file":"src/webgl/material.js","line":161,"description":"<p>Texture Util functions</p>\n","class":"p5","module":"Lights, Camera","submodule":"Material"},{"file":"src/webgl/material.js","line":182,"description":"<p>Checks whether val is a pot\nmore info on power of 2 here:\n<a href=\"https://www.opengl.org/wiki/NPOT_Texture\">https://www.opengl.org/wiki/NPOT_Texture</a></p>\n","params":[{"name":"value","description":"","type":"Number"}],"return":{"description":"","type":"Boolean"},"class":"p5","module":"Lights, Camera","submodule":"Material"},{"file":"src/webgl/material.js","line":193,"description":"<p>returns the next highest power of 2 value</p>\n","params":[{"name":"value","description":"<p>[description]</p>\n","type":"Number"}],"return":{"description":"[description]","type":"Number"},"class":"p5","module":"Lights, Camera","submodule":"Material"},{"file":"src/webgl/material.js","line":205,"description":"<p>Ambient material for geometry with a given color. You can view all\npossible materials in this\n<a href=\"https://p5js.org/examples/examples/3D_Materials.php\">example</a>.</p>\n","itemtype":"method","name":"ambientMaterial","params":[{"name":"v1","description":"<p>gray value,\nred or hue value (depending on the current color mode),\nor color Array, or CSS color string</p>\n","type":"Number|Array|String|p5.Color"},{"name":"v2","description":"<p>optional: green or saturation value</p>\n","type":"Number","optional":true},{"name":"v3","description":"<p>optional: blue or brightness value</p>\n","type":"Number","optional":true},{"name":"a","description":"<p>optional: opacity</p>\n","type":"Number","optional":true}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n}\nfunction draw(){\n background(0);\n ambientLight(100);\n pointLight(250, 250, 250, 100, 100, 0);\n ambientMaterial(250);\n sphere(200);\n}\n</code>\n</div>"],"class":"p5","module":"Lights, Camera","submodule":"Material"},{"file":"src/webgl/material.js","line":255,"description":"<p>Specular material for geometry with a given color. You can view all\npossible materials in this\n<a href=\"https://p5js.org/examples/examples/3D_Materials.php\">example</a>.</p>\n","itemtype":"method","name":"specularMaterial","params":[{"name":"v1","description":"<p>gray value,\nred or hue value (depending on the current color mode),\nor color Array, or CSS color string</p>\n","type":"Number|Array|String|p5.Color"},{"name":"v2","description":"<p>optional: green or saturation value</p>\n","type":"Number","optional":true},{"name":"v3","description":"<p>optional: blue or brightness value</p>\n","type":"Number","optional":true},{"name":"a","description":"<p>optional: opacity</p>\n","type":"Number","optional":true}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n}\nfunction draw(){\n background(0);\n ambientLight(100);\n pointLight(250, 250, 250, 100, 100, 0);\n specularMaterial(250);\n sphere(200);\n}\n</code>\n</div>"],"class":"p5","module":"Lights, Camera","submodule":"Material"},{"file":"src/webgl/material.js","line":301,"access":"private","tagname":"blends colors according to color components.\nIf alpha value is less than 1, we need to enable blending\non our gl context. Otherwise opaque objects need to a depthMask.","params":[{"name":"v1","description":"<p>[description]</p>\n","type":"Number"},{"name":"v2","description":"<p>[description]</p>\n","type":"Number"},{"name":"v3","description":"<p>[description]</p>\n","type":"Number"},{"name":"a","description":"<p>[description]</p>\n","type":"Number"}],"return":{"description":"Normalized numbers array","type":"[Number]"},"class":"p5","module":"Lights, Camera","submodule":"Material"},{"file":"src/webgl/p5.Geometry.js","line":7,"description":"<p>p5 Geometry class</p>\n","is_constructor":1,"params":[{"name":"vertData","description":"<p>callback function or Object\n containing routine(s) for vertex data generation</p>\n","type":"Function | Object"},{"name":"detailX","description":"<p>number of vertices on horizontal surface</p>\n","type":"Number","optional":true},{"name":"detailY","description":"<p>number of vertices on horizontal surface</p>\n","type":"Number","optional":true},{"name":"callback","description":"<p>function to call upon object instantiation.</p>\n","type":"Function","optional":true}],"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Geometry.js","line":71,"description":"<p>computes smooth normals per vertex as an average of each\nface.</p>\n","class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Geometry.js","line":95,"description":"<p>Averages the vertex normals. Used in curved\nsurfaces</p>\n","return":{"description":"","type":"p5.Geometry"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Geometry.js","line":114,"description":"<p>Averages pole normals. Used in spherical primitives</p>\n","return":{"description":"","type":"p5.Geometry"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Geometry.js","line":146,"description":"<p>Modifies all vertices to be centered within the range -100 to 100.</p>\n","return":{"description":"","type":"p5.Geometry"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Matrix.js","line":1,"requires":["constants"],"todo":["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"],"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Matrix.js","line":19,"description":"<p>A class to describe a 4x4 matrix\nfor model and view matrix manipulation in the p5js webgl renderer.\nclass p5.Matrix</p>\n","is_constructor":1,"params":[{"name":"mat4","description":"<p>array literal of our 4x4 matrix</p>\n","type":"Array","optional":true}],"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Matrix.js","line":74,"description":"<p>Sets the x, y, and z component of the vector using two or three separate\nvariables, the data from a p5.Matrix, or the values from a float array.</p>\n","params":[{"name":"inMatrix","description":"<p>the input p5.Matrix or\n an Array of length 16</p>\n","type":"p5.Matrix|Array","optional":true}],"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Matrix.js","line":93,"description":"<p>Gets a copy of the vector, returns a p5.Matrix object.</p>\n","return":{"description":"the copy of the p5.Matrix object","type":"p5.Matrix"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Matrix.js","line":102,"description":"<p>return a copy of a matrix</p>\n","return":{"description":"the result matrix","type":"p5.Matrix"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Matrix.js","line":127,"description":"<p>return an identity matrix</p>\n","return":{"description":"the result matrix","type":"p5.Matrix"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Matrix.js","line":135,"description":"<p>transpose according to a given matrix</p>\n","params":[{"name":"a","description":"<p>the matrix to be based on to transpose</p>\n","type":"p5.Matrix | Typed Array"}],"return":{"description":"this","type":"p5.Matrix"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Matrix.js","line":195,"description":"<p>invert matrix according to a give matrix</p>\n","params":[{"name":"a","description":"<p>the matrix to be based on to invert</p>\n","type":"p5.Matrix or Typed Array"}],"return":{"description":"this","type":"p5.Matrix"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Matrix.js","line":280,"description":"<p>Inverts a 3x3 matrix</p>\n","return":{"description":"[description]","type":"[type]"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Matrix.js","line":316,"description":"<p>transposes a 3x3 p5.Matrix by a mat3</p>\n","params":[{"name":"mat3","description":"<p>1-dimensional array</p>\n","type":"[Number]"}],"return":{"description":"this","type":"p5.Matrix"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Matrix.js","line":332,"description":"<p>converts a 4x4 matrix to its 3x3 inverse tranform\ncommonly used in MVMatrix to NMatrix conversions.</p>\n","params":[{"name":"mat4","description":"<p>the matrix to be based on to invert</p>\n","type":"p5.Matrix"}],"return":{"description":"this with mat3","type":"p5.Matrix"},"todo":["finish implementation"],"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Matrix.js","line":360,"description":"<p>inspired by Toji&#39;s mat4 determinant</p>\n","return":{"description":"Determinant of our 4x4 matrix","type":"Number"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Matrix.js","line":383,"description":"<p>multiply two mat4s</p>\n","params":[{"name":"multMatrix","description":"<p>The matrix we want to multiply by</p>\n","type":"p5.Matrix | Array"}],"return":{"description":"this","type":"p5.Matrix"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Matrix.js","line":439,"description":"<p>scales a p5.Matrix by scalars or a vector</p>\n","params":[{"name":"UNKNOWN","description":"<p>vector to scale by</p>\n","type":"p5.Vector | Array"}],"return":{"description":"this","type":"p5.Matrix"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Matrix.js","line":485,"description":"<p>rotate our Matrix around an axis by the given angle.</p>\n","params":[{"name":"a","description":"<p>The angle of rotation in radians</p>\n","type":"Number"},{"name":"axis","description":"<p>the axis(es) to rotate around</p>\n","type":"p5.Vector | Array"}],"return":{"description":"this\ninspired by Toji's gl-matrix lib, mat4 rotation","type":"p5.Matrix"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Matrix.js","line":564,"todo":["finish implementing this method!\ntranslates"],"params":[{"name":"v","description":"<p>vector to translate by</p>\n","type":"Array"}],"return":{"description":"this","type":"p5.Matrix"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Matrix.js","line":594,"description":"<p>sets the perspective matrix</p>\n","params":[{"name":"fovy","description":"<p>[description]</p>\n","type":"Number"},{"name":"aspect","description":"<p>[description]</p>\n","type":"Number"},{"name":"near","description":"<p>near clipping plane</p>\n","type":"Number"},{"name":"far","description":"<p>far clipping plane</p>\n","type":"Number"}],"return":{"description":"","type":"Void"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Matrix.js","line":628,"description":"<p>sets the ortho matrix</p>\n","params":[{"name":"left","description":"<p>[description]</p>\n","type":"Number"},{"name":"right","description":"<p>[description]</p>\n","type":"Number"},{"name":"bottom","description":"<p>[description]</p>\n","type":"Number"},{"name":"top","description":"<p>[description]</p>\n","type":"Number"},{"name":"near","description":"<p>near clipping plane</p>\n","type":"Number"},{"name":"far","description":"<p>far clipping plane</p>\n","type":"Number"}],"return":{"description":"","type":"Void"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.Matrix.js","line":663,"description":"<p>PRIVATE</p>\n","class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.Immediate.js","line":1,"description":"<p>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 beginShape() &amp; de-activated when you call endShape().\nImmediate mode is a style of programming borrowed\nfrom OpenGL&#39;s (now-deprecated) immediate mode.\nIt differs from p5.js&#39; default, Retained Mode, which caches\ngeometries and buffers on the CPU to reduce the number of webgl\ndraw calls. Retained mode is more efficient &amp; performative,\nhowever, Immediate Mode is useful for sketching quick\ngeometric ideas.</p>\n","class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.Immediate.js","line":19,"description":"<p>Begin shape drawing. This is a helpful way of generating\ncustom shapes quickly. However in WEBGL mode, application\nperformance will likely drop as a result of too many calls to\nbeginShape() / endShape(). As a high performance alternative,\nplease use p5.js geometry primitives.</p>\n","params":[{"name":"mode","description":"<p>webgl primitives mode. beginShape supports the\n following modes:\n POINTS,LINES,LINE_STRIP,LINE_LOOP,TRIANGLES,\n TRIANGLE_STRIP,and TRIANGLE_FAN.</p>\n","type":"Number"}],"return":{"description":"[description]","type":"[type]"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.Immediate.js","line":49,"description":"<p>adds a vertex to be drawn in a custom Shape.</p>\n","params":[{"name":"x","description":"<p>x-coordinate of vertex</p>\n","type":"Number"},{"name":"y","description":"<p>y-coordinate of vertex</p>\n","type":"Number"},{"name":"z","description":"<p>z-coordinate of vertex</p>\n","type":"Number"}],"return":{"description":"[description]","type":"p5.RendererGL"},"todo":["implement handling of p5.Vector args"],"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.Immediate.js","line":68,"description":"<p>End shape drawing and render vertices to screen.</p>\n","return":{"description":"[description]","type":"p5.RendererGL"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.Immediate.js","line":121,"description":"<p>Bind immediateMode buffers to data,\nthen draw gl arrays</p>\n","params":[{"name":"vertices","description":"<p>Numbers array representing\n vertex positions</p>\n","type":"Array"}],"return":{"description":"","type":"p5.RendererGL"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.Retained.js","line":7,"description":"<p>initializes buffer defaults. runs each time a new geometry is\nregistered</p>\n","params":[{"name":"gId","description":"<p>key of the geometry object</p>\n","type":"String"}],"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.Retained.js","line":30,"description":"<p>createBuffers description</p>\n","params":[{"name":"gId","description":"<p>key of the geometry object</p>\n","type":"String"},{"name":"obj","description":"<p>contains geometry data</p>\n","type":"p5.Geometry"}],"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.Retained.js","line":93,"description":"<p>Draws buffers given a geometry key ID</p>\n","params":[{"name":"gId","description":"<p>ID in our geom hash</p>\n","type":"String"}],"return":{"description":"this","type":"p5.RendererGL"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.Retained.js","line":129,"description":"<p>turn a two dimensional array into one dimensional array</p>\n","params":[{"name":"arr","description":"<p>2-dimensional array</p>\n","type":"Array"}],"return":{"description":"1-dimensional array\n[[1, 2, 3],[4, 5, 6]] -> [1, 2, 3, 4, 5, 6]","type":"Array"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.Retained.js","line":145,"description":"<p>turn a p5.Vector Array into a one dimensional number array</p>\n","params":[{"name":"arr","description":"<p>an array of p5.Vector</p>\n","type":"Array"}],"return":{"description":"a one dimensional array of numbers\n[p5.Vector(1, 2, 3), p5.Vector(4, 5, 6)] ->\n[1, 2, 3, 4, 5, 6]","type":"Array]"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.js","line":43,"description":"<p>model view, projection, &amp; normal\nmatrices</p>\n","class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.js","line":106,"description":"<p>[background description]</p>\n","return":{"description":"[description]","type":"[type]"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.js","line":130,"description":"<p>[_initShaders description]</p>\n","params":[{"name":"vertId","description":"<p>[description]</p>\n","type":"String"},{"name":"fragId","description":"<p>[description]</p>\n","type":"String"}],"return":{"description":"[description]","type":"[type]"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.js","line":205,"description":"<p>Sets a shader uniform given a shaderProgram and uniform string</p>\n","params":[{"name":"shaderKey","description":"<p>key to material Hash.</p>\n","type":"String"},{"name":"uniform","description":"<p>location in shader.</p>\n","type":"String"},{"name":"data","description":"<p>data to bind uniform. Float data type.</p>\n","type":"Number"}],"todo":["currently this function sets uniform1f data.\nShould generalize function to accept any uniform\ndata type."],"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.js","line":280,"description":"<p>Basic fill material for geometry with a given color</p>\n","itemtype":"method","name":"fill","params":[{"name":"v1","description":"<p>gray value,\nred or hue value (depending on the current color mode),\nor color Array, or CSS color string</p>\n","type":"Number|Array|String|p5.Color"},{"name":"v2","description":"<p>optional: green or saturation value</p>\n","type":"Number","optional":true},{"name":"v3","description":"<p>optional: blue or brightness value</p>\n","type":"Number","optional":true},{"name":"a","description":"<p>optional: opacity</p>\n","type":"Number","optional":true}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw(){\n background(0);\n fill(250, 0, 0);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n rotateZ(frameCount * 0.01);\n box(200, 200, 200);\n}\n</code>\n</div>"],"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.js","line":353,"description":"<p>[strokeWeight description]</p>\n","params":[{"name":"pointSize","description":"<p>stroke point size</p>\n","type":"Number"}],"return":{"description":"[description]","type":"[type]"},"todo":["strokeWeight currently works on points only.\nimplement on all wireframes and strokes."],"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.js","line":376,"description":"<p>[resize description]</p>\n","params":[{"name":"w","description":"<p>[description]</p>\n","type":"[type]"},{"name":"h","description":"<p>[description]</p>\n","type":"[tyoe]"}],"return":{"description":"[description]","type":"[type]"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.js","line":393,"description":"<p>clears color and depth buffers\nwith r,g,b,a</p>\n","params":[{"name":"r","description":"<p>normalized red val.</p>\n","type":"Number"},{"name":"g","description":"<p>normalized green val.</p>\n","type":"Number"},{"name":"b","description":"<p>normalized blue val.</p>\n","type":"Number"},{"name":"a","description":"<p>normalized alpha val.</p>\n","type":"Number"}],"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.js","line":410,"description":"<p>[translate description]</p>\n","params":[{"name":"x","description":"<p>[description]</p>\n","type":"[type]"},{"name":"y","description":"<p>[description]</p>\n","type":"[type]"},{"name":"z","description":"<p>[description]</p>\n","type":"[type]"}],"return":{"description":"[description]","type":"[type]"},"todo":["implement handle for components or vector as args"],"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.js","line":427,"description":"<p>Scales the Model View Matrix by a vector</p>\n","params":[{"name":"x","description":"<p>[description]</p>\n","type":"Number | p5.Vector | Array"},{"name":"y","description":"<p>y-axis scalar</p>\n","type":"Number","optional":true},{"name":"z","description":"<p>z-axis scalar</p>\n","type":"Number","optional":true}],"return":{"description":"[description]","type":"This"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.js","line":459,"description":"<p>pushes a copy of the model view matrix onto the\nMV Matrix stack.</p>\n","class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/p5.RendererGL.js","line":467,"description":"<p>[pop description]</p>\n","return":{"description":"[description]","type":"[type]"},"class":"p5.RendererGL","module":"Lights, Camera"},{"file":"src/webgl/primitives.js","line":13,"description":"<p>Draw a plane with given a width and height</p>\n","itemtype":"method","name":"plane","params":[{"name":"width","description":"<p>width of the plane</p>\n","type":"Number"},{"name":"height","description":"<p>height of the plane</p>\n","type":"Number"},{"name":"detailX","description":"<p>Optional number of triangle\n subdivisions in x-dimension</p>\n","type":"Number","optional":true},{"name":"detailY","description":"<p>Optional number of triangle\n subdivisions in y-dimension</p>\n","type":"Number","optional":true}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\n//draw a plane with width 200 and height 200\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw(){\n background(200);\n plane(200, 200);\n}\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"3D Primitives"},{"file":"src/webgl/primitives.js","line":77,"description":"<p>Draw a box with given width, height and depth</p>\n","itemtype":"method","name":"box","params":[{"name":"width","description":"<p>width of the box</p>\n","type":"Number"},{"name":"Height","description":"<p>height of the box</p>\n","type":"Number"},{"name":"depth","description":"<p>depth of the box</p>\n","type":"Number"},{"name":"detailX","description":"<p>Optional number of triangle\n subdivisions in x-dimension</p>\n","type":"Number","optional":true},{"name":"detailY","description":"<p>Optional number of triangle\n subdivisions in y-dimension</p>\n","type":"Number","optional":true}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\n//draw a spinning box with width, height and depth 200\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw(){\n background(200);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n box(200, 200, 200);\n}\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"3D Primitives"},{"file":"src/webgl/primitives.js","line":162,"description":"<p>Draw a sphere with given radius</p>\n","itemtype":"method","name":"sphere","params":[{"name":"radius","description":"<p>radius of circle</p>\n","type":"Number"},{"name":"detailX","description":"<p>optional: number of segments,\n the more segments the smoother geometry\n default is 24</p>\n","type":"Number","optional":true},{"name":"detailY","description":"<p>optional: number of segments,\n the more segments the smoother geometry\n default is 16</p>\n","type":"Number","optional":true}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\n// draw a sphere with radius 200\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw(){\n background(200);\n sphere(200);\n}\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"3D Primitives"},{"file":"src/webgl/primitives.js","line":230,"access":"private","tagname":"helper function for creating both cones and cyllinders","class":"p5","module":"Shape","submodule":"3D Primitives"},{"file":"src/webgl/primitives.js","line":308,"description":"<p>Draw a cylinder with given radius and height</p>\n","itemtype":"method","name":"cylinder","params":[{"name":"radius","description":"<p>radius of the surface</p>\n","type":"Number"},{"name":"height","description":"<p>height of the cylinder</p>\n","type":"Number"},{"name":"detailX","description":"<p>optional: number of segments,\n the more segments the smoother geometry\n default is 24</p>\n","type":"Number","optional":true},{"name":"detailY","description":"<p>optional: number of segments in y-dimension,\n the more segments the smoother geometry\n default is 16</p>\n","type":"Number","optional":true}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\n//draw a spinning cylinder with radius 200 and height 200\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw(){\n background(200);\n rotateX(frameCount * 0.01);\n rotateZ(frameCount * 0.01);\n cylinder(200, 200);\n}\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"3D Primitives"},{"file":"src/webgl/primitives.js","line":367,"description":"<p>Draw a cone with given radius and height</p>\n","itemtype":"method","name":"cone","params":[{"name":"radius","description":"<p>radius of the bottom surface</p>\n","type":"Number"},{"name":"height","description":"<p>height of the cone</p>\n","type":"Number"},{"name":"detailX","description":"<p>optional: number of segments,\n the more segments the smoother geometry\n default is 24</p>\n","type":"Number","optional":true},{"name":"detailY","description":"<p>optional: number of segments,\n the more segments the smoother geometry\n default is 16</p>\n","type":"Number","optional":true}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\n//draw a spinning cone with radius 200 and height 200\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw(){\n background(200);\n rotateX(frameCount * 0.01);\n rotateZ(frameCount * 0.01);\n cone(200, 200);\n}\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"3D Primitives"},{"file":"src/webgl/primitives.js","line":427,"description":"<p>Draw an ellipsoid with given raduis</p>\n","itemtype":"method","name":"ellipsoid","params":[{"name":"radiusx","description":"<p>xradius of circle</p>\n","type":"Number"},{"name":"radiusy","description":"<p>yradius of circle</p>\n","type":"Number"},{"name":"radiusz","description":"<p>zradius of circle</p>\n","type":"Number"},{"name":"detailX","description":"<p>optional: number of segments,\n the more segments the smoother geometry\n default is 24. Avoid detail number above\n 150, it may crash the browser.</p>\n","type":"Number","optional":true},{"name":"detailY","description":"<p>optional: number of segments,\n the more segments the smoother geometry\n default is 16. Avoid detail number above\n 150, it may crash the browser.</p>\n","type":"Number","optional":true}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\n// draw an ellipsoid with radius 200, 300 and 400 .\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw(){\n background(200);\n ellipsoid(200,300,400);\n}\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"3D Primitives"},{"file":"src/webgl/primitives.js","line":501,"description":"<p>Draw a torus with given radius and tube radius</p>\n","itemtype":"method","name":"torus","params":[{"name":"radius","description":"<p>radius of the whole ring</p>\n","type":"Number"},{"name":"tubeRadius","description":"<p>radius of the tube</p>\n","type":"Number"},{"name":"detailX","description":"<p>optional: number of segments in x-dimension,\n the more segments the smoother geometry\n default is 24</p>\n","type":"Number","optional":true},{"name":"detailY","description":"<p>optional: number of segments in y-dimension,\n the more segments the smoother geometry\n default is 16</p>\n","type":"Number","optional":true}],"return":{"description":"the p5 object","type":"P5"},"example":["\n<div>\n<code>\n//draw a spinning torus with radius 200 and tube radius 60\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw(){\n background(200);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n torus(200, 60);\n}\n</code>\n</div>"],"class":"p5","module":"Shape","submodule":"3D Primitives"},{"file":"src/app.js","line":62,"description":"<p>_globalInit</p>\n<p>TODO: ???\nif sketch is on window\nassume &quot;global&quot; mode\nand instantiate p5 automatically\notherwise do nothing</p>\n","return":{"description":"","type":"Undefined"},"class":"p5.dom","module":"Shape"},{"file":"lib/addons/p5.dom.js","line":40,"description":"<p>Searches the page for an element with the given ID, class, or tag name (using the &#39;#&#39; or &#39;.&#39;\nprefixes to specify an ID or class respectively, and none for a tag) and returns it as\na p5.Element. If a class or tag name is given with more than 1 element,\nonly the first element will be returned.\nThe DOM node itself can be accessed with .elt.\nReturns null if none found. You can also specify a container to search within.</p>\n","itemtype":"method","name":"select","params":[{"name":"name","description":"<p>id, class, or tag name of element to search for</p>\n","type":"String"},{"name":"container","description":"<p>id, p5.Element, or HTML element to search within</p>\n","type":"String","optional":true}],"return":{"description":"p5.Element containing node found","type":"Object/p5.Element|Null"},"example":["\n<div ><code class='norender'>\nfunction setup() {\n createCanvas(100,100);\n //translates canvas 50px down\n select('canvas').position(100, 100);\n}\n</code></div>\n<div ><code class='norender'>\n// these are all valid calls to select()\nvar a = select('#moo');\nvar b = select('#blah', '#myContainer');\nvar c = select('#foo', b);\nvar d = document.getElementById('beep');\nvar e = select('p', d);\n</code></div>\n"],"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":99,"description":"<p>Searches the page for elements with the given class or tag name (using the &#39;.&#39; prefix\nto specify a class and no prefix for a tag) and returns them as p5.Elements\nin an array.\nThe DOM node itself can be accessed with .elt.\nReturns an empty array if none found.\nYou can also specify a container to search within.</p>\n","itemtype":"method","name":"selectAll","params":[{"name":"name","description":"<p>class or tag name of elements to search for</p>\n","type":"String"},{"name":"container","description":"<p>id, p5.Element, or HTML element to search within</p>\n","type":"String","optional":true}],"return":{"description":"Array of p5.Elements containing nodes found","type":"Array"},"example":["\n<div class='norender'><code>\nfunction setup() {\n createButton('btn');\n createButton('2nd btn');\n createButton('3rd btn');\n var buttons = selectAll('button');\n\n for (var i = 0; i < buttons.length; i++){\n buttons[i].size(100,100);\n }\n}\n</code></div>\n<div class='norender'><code>\n// these are all valid calls to selectAll()\nvar a = selectAll('.moo');\nvar b = selectAll('div');\nvar c = selectAll('button', '#myContainer');\nvar d = select('#container');\nvar e = selectAll('p', d);\nvar f = document.getElementById('beep');\nvar g = select('.blah', f);\n</code></div>\n"],"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":155,"description":"<p>Helper function for select and selectAll</p>\n","class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":171,"description":"<p>Helper function for getElement and getElements.</p>\n","class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":195,"description":"<p>Removes all elements created by p5, except any canvas / graphics\nelements created by createCanvas or createGraphics.\nEvent handlers are removed, and element is removed from the DOM.</p>\n","itemtype":"method","name":"removeElements","example":["\n<div class='norender'><code>\nfunction setup() {\n createCanvas(100, 100);\n createDiv('this is some text');\n createP('this is a paragraph');\n}\nfunction mousePressed() {\n removeElements(); // this will remove the div and p, not canvas\n}\n</code></div>\n"],"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":221,"description":"<p>Helpers for create methods.</p>\n","class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":232,"description":"<p>Creates a &lt;div&gt;&lt;/div&gt; element in the DOM with given inner HTML.\nAppends to the container node if one is specified, otherwise\nappends to body.</p>\n","itemtype":"method","name":"createDiv","params":[{"name":"html","description":"<p>inner HTML for element created</p>\n","type":"String"}],"return":{"description":"pointer to p5.Element holding created node","type":"Object/p5.Element"},"example":["\n<div class='norender'><code>\nvar myDiv;\nfunction setup() {\n myDiv = createDiv('this is some text');\n}\n</code></div>"],"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":249,"description":"<p>Creates a &lt;p&gt;&lt;/p&gt; element in the DOM with given inner HTML. Used\nfor paragraph length text.\nAppends to the container node if one is specified, otherwise\nappends to body.</p>\n","itemtype":"method","name":"createP","params":[{"name":"html","description":"<p>inner HTML for element created</p>\n","type":"String"}],"return":{"description":"pointer to p5.Element holding created node","type":"Object/p5.Element"},"example":["\n<div class='norender'><code>\nvar myP;\nfunction setup() {\n myP = createP('this is some text');\n}\n</code></div>"],"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":267,"description":"<p>Creates a &lt;span&gt;&lt;/span&gt; element in the DOM with given inner HTML.\nAppends to the container node if one is specified, otherwise\nappends to body.</p>\n","itemtype":"method","name":"createSpan","params":[{"name":"html","description":"<p>inner HTML for element created</p>\n","type":"String"}],"return":{"description":"pointer to p5.Element holding created node","type":"Object/p5.Element"},"example":["\n<div class='norender'><code>\nvar mySpan;\nfunction setup() {\n mySpan = createSpan('this is some text');\n}\n</code></div>"],"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":293,"description":"<p>Creates an &lt;img /&gt; element in the DOM with given src and\nalternate text.\nAppends to the container node if one is specified, otherwise\nappends to body.</p>\n","itemtype":"method","name":"createImg","params":[{"name":"src","description":"<p>src path or url for image</p>\n","type":"String"},{"name":"alt","description":"<p>alternate text to be used if image does not load</p>\n","type":"String","optional":true},{"name":"successCallback","description":"<p>callback to be called once image data is loaded</p>\n","type":"Function","optional":true}],"return":{"description":"pointer to p5.Element holding created node","type":"Object/p5.Element"},"example":["\n<div class='norender'><code>\nvar img;\nfunction setup() {\n img = createImg('http://p5js.org/img/asterisk-01.png');\n}\n</code></div>"],"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":338,"description":"<p>Creates an &lt;a&gt;&lt;/a&gt; element in the DOM for including a hyperlink.\nAppends to the container node if one is specified, otherwise\nappends to body.</p>\n","itemtype":"method","name":"createA","params":[{"name":"href","description":"<p>url of page to link to</p>\n","type":"String"},{"name":"html","description":"<p>inner html of link element to display</p>\n","type":"String"},{"name":"target","description":"<p>target where new link should open,\n could be _blank, _self, _parent, _top.</p>\n","type":"String","optional":true}],"return":{"description":"pointer to p5.Element holding created node","type":"Object/p5.Element"},"example":["\n<div class='norender'><code>\nvar myLink;\nfunction setup() {\n myLink = createA('http://p5js.org/', 'this is a link');\n}\n</code></div>"],"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":365,"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":368,"description":"<p>Creates a slider &lt;input&gt;&lt;/input&gt; element in the DOM.\nUse .size() to set the display length of the slider.\nAppends to the container node if one is specified, otherwise\nappends to body.</p>\n","itemtype":"method","name":"createSlider","params":[{"name":"min","description":"<p>minimum value of the slider</p>\n","type":"Number"},{"name":"max","description":"<p>maximum value of the slider</p>\n","type":"Number"},{"name":"value","description":"<p>default value of the slider</p>\n","type":"Number","optional":true},{"name":"step","description":"<p>step size for each tick of the slider</p>\n","type":"Number","optional":true}],"return":{"description":"pointer to p5.Element holding created node","type":"Object/p5.Element"},"example":["\n<div><code>\nvar slider;\nfunction setup() {\n slider = createSlider(0, 255, 100);\n slider.position(10, 10);\n slider.style('width', '80px');\n}\n\nfunction draw() {\n var val = slider.value();\n background(val);\n}\n</code></div>\n\n<div><code>\nvar slider;\nfunction setup() {\n colorMode(HSB);\n slider = createSlider(0, 360, 60, 40);\n slider.position(10, 10);\n slider.style('width', '80px');\n}\n\nfunction draw() {\n var val = slider.value();\n background(val, 100, 100, 1);\n}\n</code></div>"],"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":420,"description":"<p>Creates a &lt;button&gt;&lt;/button&gt; element in the DOM.\nUse .size() to set the display size of the button.\nUse .mousePressed() to specify behavior on press.\nAppends to the container node if one is specified, otherwise\nappends to body.</p>\n","itemtype":"method","name":"createButton","params":[{"name":"label","description":"<p>label displayed on the button</p>\n","type":"String"},{"name":"value","description":"<p>value of the button</p>\n","type":"String","optional":true}],"return":{"description":"pointer to p5.Element holding created node","type":"Object/p5.Element"},"example":["\n<div class='norender'><code>\nvar button;\nfunction setup() {\n createCanvas(100, 100);\n background(0);\n button = createButton('click me');\n button.position(19, 19);\n button.mousePressed(changeBG);\n}\n\nfunction changeBG() {\n var val = random(255);\n background(val);\n}\n</code></div>"],"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":456,"description":"<p>Creates a checkbox &lt;input&gt;&lt;/input&gt; element in the DOM.\nCalling .checked() on a checkbox returns if it is checked or not</p>\n","itemtype":"method","name":"createCheckbox","params":[{"name":"label","description":"<p>label displayed after checkbox</p>\n","type":"String","optional":true},{"name":"value","description":"<p>value of the checkbox; checked is true, unchecked is false.Unchecked if no value given</p>\n","type":"Boolean","optional":true}],"return":{"description":"pointer to p5.Element holding created node","type":"Object/p5.Element"},"example":["\n<div class='norender'><code>\nvar checkbox;\n\nfunction setup() {\n checkbox = createCheckbox('label', false);\n checkbox.changed(myCheckedEvent);\n}\n\nfunction myCheckedEvent() {\n if (this.checked()) {\n console.log(\"Checking!\");\n } else {\n console.log(\"Unchecking!\");\n }\n}\n</code></div>"],"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":521,"description":"<p>Creates a dropdown menu &lt;select&gt;&lt;/select&gt; element in the DOM.</p>\n","itemtype":"method","name":"createSelect","params":[{"name":"multiple","description":"<p>[true if dropdown should support multiple selections]</p>\n","type":"Boolean","optional":true}],"return":{"description":"pointer to p5.Element holding created node","type":"Object/p5.Element"},"example":["\n<div><code>\nvar sel;\n\nfunction setup() {\n textAlign(CENTER);\n background(200);\n sel = createSelect();\n sel.position(10, 10);\n sel.option('pear');\n sel.option('kiwi');\n sel.option('grape');\n sel.changed(mySelectEvent);\n}\n\nfunction mySelectEvent() {\n var item = sel.value();\n background(200);\n text(\"it's a \"+item+\"!\", 50, 50);\n}\n</code></div>"],"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":586,"description":"<p>Creates a radio button &lt;input&gt;&lt;/input&gt; element in the DOM.\nThe .option() method can be used to set options for the radio after it is\ncreated. The .value() method will return the currently selected option.</p>\n","itemtype":"method","name":"createRadio","params":[{"name":"divId","description":"<p>the id and name of the created div and input field respectively</p>\n","type":"String","optional":true}],"return":{"description":"pointer to p5.Element holding created node","type":"Object/p5.Element"},"example":["\n<div><code>\nvar radio;\n\nfunction setup() {\n radio = createRadio();\n radio.option(\"black\");\n radio.option(\"white\");\n radio.option(\"gray\");\n radio.style('width', '60px');\n textAlign(CENTER);\n fill(255, 0, 0);\n}\n\nfunction draw() {\n var val = radio.value();\n background(val);\n text(val, width/2, height/2);\n}\n</code></div>\n<div><code>\nvar radio;\n\nfunction setup() {\n radio = createRadio();\n radio.option('apple', 1);\n radio.option('bread', 2);\n radio.option('juice', 3);\n radio.style('width', '60px');\n textAlign(CENTER);\n}\n\nfunction draw() {\n background(200);\n var val = radio.value();\n if (val) {\n text('item cost is $'+val, width/2, height/2);\n }\n}\n</code></div>"],"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":712,"description":"<p>Creates an &lt;input&gt;&lt;/input&gt; element in the DOM for text input.\nUse .size() to set the display length of the box.\nAppends to the container node if one is specified, otherwise\nappends to body.</p>\n","itemtype":"method","name":"createInput","params":[{"name":"value","description":"<p>default value of the input box</p>\n","type":"Number","optional":true}],"return":{"description":"pointer to p5.Element holding created node","type":"Object/p5.Element"},"example":["\n<div class='norender'><code>\nfunction setup(){\n var inp = createInput('');\n inp.input(myInputEvent);\n}\n\nfunction myInputEvent(){\n console.log('you are typing: ', this.value());\n}\n\n</code></div>"],"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":741,"description":"<p>Creates an &lt;input&gt;&lt;/input&gt; element in the DOM of type &#39;file&#39;.\nThis allows users to select local files for use in a sketch.</p>\n","itemtype":"method","name":"createFileInput","params":[{"name":"callback","description":"<p>callback function for when a file loaded</p>\n","type":"Function","optional":true},{"name":"multiple","description":"<p>optional to allow multiple files selected</p>\n","type":"String","optional":true}],"return":{"description":"pointer to p5.Element holding created DOM element","type":"Object/p5.Element"},"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":804,"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":841,"description":"<p>Creates an HTML5 &lt;video&gt; element in the DOM for simple playback\nof audio/video. Shown by default, can be hidden with .hide()\nand drawn into canvas using video(). Appends to the container\nnode if one is specified, otherwise appends to body. The first parameter\ncan be either a single string path to a video file, or an array of string\npaths to different formats of the same video. This is useful for ensuring\nthat your video can play across different browsers, as each supports\ndifferent formats. See <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats\">this\npage</a> for further information about supported formats.</p>\n","itemtype":"method","name":"createVideo","params":[{"name":"src","description":"<p>path to a video file, or array of paths for\n supporting different browsers</p>\n","type":"String|Array"},{"name":"callback","description":"<p>callback function to be called upon\n &#39;canplaythrough&#39; event fire, that is, when the\n browser can play the media, and estimates that\n enough data has been loaded to play the media\n up to its end without having to stop for\n further buffering of content</p>\n","type":"Object","optional":true}],"return":{"description":"pointer to video p5.Element","type":"Object/p5.Element"},"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":867,"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":869,"description":"<p>Creates a hidden HTML5 &lt;audio&gt; element in the DOM for simple audio\nplayback. Appends to the container node if one is specified,\notherwise appends to body. The first parameter\ncan be either a single string path to a audio file, or an array of string\npaths to different formats of the same audio. This is useful for ensuring\nthat your audio can play across different browsers, as each supports\ndifferent formats. See <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats\">this\npage for further information about supported formats</a>.</p>\n","itemtype":"method","name":"createAudio","params":[{"name":"src","description":"<p>path to an audio file, or array of paths for\n supporting different browsers</p>\n","type":"String|Array"},{"name":"callback","description":"<p>callback function to be called upon\n &#39;canplaythrough&#39; event fire, that is, when the\n browser can play the media, and estimates that\n enough data has been loaded to play the media\n up to its end without having to stop for\n further buffering of content</p>\n","type":"Object","optional":true}],"return":{"description":"pointer to audio p5.Element","type":"Object/p5.Element"},"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":895,"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":905,"description":"<p>Creates a new &lt;video&gt; element that contains the audio/video feed\nfrom a webcam. This can be drawn onto the canvas using video().</p>\n<p>More specific properties of the feed can be passing in a Constraints object.\nSee the\n<a href=\"http://w3c.github.io/mediacapture-main/getusermedia.html#media-track-constraints\"> W3C\nspec</a> for possible properties. Note that not all of these are supported\nby all browsers.</p>\n<p>Security note: A new browser security specification requires that getUserMedia,\nwhich is behind createCapture(), only works when you&#39;re running the code locally,\nor on HTTPS. Learn more <a href=\"http://stackoverflow.com/questions/34197653/getusermedia-in-chrome-47-without-using-https\">here</a>\nand <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia\">here</a>.</p>","itemtype":"method","name":"createCapture","params":[{"name":"type","description":"<p>type of capture, either VIDEO or\n AUDIO if none specified, default both,\n or a Constraints object</p>\n","type":"String|Constant|Object"},{"name":"callback","description":"<p>function to be called once\n stream has loaded</p>\n","type":"Function"}],"return":{"description":"capture video p5.Element","type":"Object/p5.Element"},"example":["\n<div class='norender'><code>\nvar capture;\n\nfunction setup() {\n createCanvas(480, 120);\n capture = createCapture(VIDEO);\n}\n\nfunction draw() {\n image(capture, 0, 0, width, width*capture.height/capture.width);\n filter(INVERT);\n}\n</code></div>\n<div class='norender'><code>\nfunction setup() {\n createCanvas(480, 120);\n var constraints = {\n video: {\n mandatory: {\n minWidth: 1280,\n minHeight: 720\n },\n optional: [\n { maxFrameRate: 10 }\n ]\n },\n audio: true\n };\n createCapture(constraints, function(stream) {\n console.log(stream);\n });\n}\n</code></div>"],"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1005,"description":"<p>Creates element with given tag in the DOM with given content.\nAppends to the container node if one is specified, otherwise\nappends to body.</p>\n","itemtype":"method","name":"createElement","params":[{"name":"tag","description":"<p>tag for the new element</p>\n","type":"String"},{"name":"content","description":"<p>html content to be inserted into the element</p>\n","type":"String","optional":true}],"return":{"description":"pointer to p5.Element holding created node","type":"Object/p5.Element"},"example":["\n<div class='norender'><code>\nvar h2 = createElement('h2','im an h2 p5.element!');\n</code></div>"],"class":"p5.dom","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1031,"description":"<p>Adds specified class to the element.</p>\n","itemtype":"method","name":"addClass","params":[{"name":"class","description":"<p>name of class to add</p>\n","type":"String"}],"return":{"description":"","type":"Object/p5.Element"},"example":["\n <div class='norender'><code>\n var div = createDiv('div');\n div.addClass('myClass');\n </code></div>"],"class":"p5.Element","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1058,"description":"<p>Removes specified class from the element.</p>\n","itemtype":"method","name":"removeClass","params":[{"name":"class","description":"<p>name of class to remove</p>\n","type":"String"}],"return":{"description":"","type":"Object/p5.Element"},"class":"p5.Element","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1073,"description":"<p>Attaches the element as a child to the parent specified.\n Accepts either a string ID, DOM node, or p5.Element.\n If no argument is specified, an array of children DOM nodes is returned.</p>\n","itemtype":"method","name":"child","params":[{"name":"child","description":"<p>the ID, DOM node, or p5.Element\n to add to the current element</p>\n","type":"String|Object|p5.Element","optional":true}],"return":{"description":"","type":"p5.Element"},"example":["\n <div class='norender'><code>\n var div0 = createDiv('this is the parent');\n var div1 = createDiv('this is the child');\n div0.child(div1); // use p5.Element\n </code></div>\n <div class='norender'><code>\n var div0 = createDiv('this is the parent');\n var div1 = createDiv('this is the child');\n div1.id('apples');\n div0.child('apples'); // use id\n </code></div>\n <div class='norender'><code>\n var div0 = createDiv('this is the parent');\n var elt = document.getElementById('myChildDiv');\n div0.child(elt); // use element from page\n </code></div>"],"class":"p5.Element","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1117,"description":"<p>Centers a p5 Element either vertically, horizontally,\nor both, relative to its parent or according to\nthe body if the Element has no parent. If no argument is passed\nthe Element is aligned both vertically and horizontally.</p>\n","params":[{"name":"align","description":"<p>passing &#39;vertical&#39;, &#39;horizontal&#39; aligns element accordingly</p>\n","type":"String"}],"return":{"description":"pointer to p5.Element","type":"Object/p5.Element"},"example":["\n<div><code>\nfunction setup() {\n var div = createDiv('').size(10,10);\n div.style('background-color','orange');\n div.center();\n\n}\n</code></div>"],"class":"p5.Element","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1170,"description":"<p>If an argument is given, sets the inner HTML of the element,\n replacing any existing html. If no arguments are given, returns\n the inner HTML of the element.</p>\n","itemtype":"method","name":"html","params":[{"name":"html","description":"<p>the HTML to be placed inside the element</p>\n","type":"String","optional":true}],"return":{"description":"","type":"Object/p5.Element|String"},"example":["\n <div class='norender'><code>\n var div = createDiv('').size(100,100);\n div.style('background-color','orange');\n div.html('hi');\n </code></div>"],"class":"p5.Element","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1196,"description":"<p>Sets the position of the element relative to (0, 0) of the\n window. Essentially, sets position:absolute and left and top\n properties of style. If no arguments given returns the x and y position\n of the element in an object.</p>\n","itemtype":"method","name":"position","params":[{"name":"x","description":"<p>x-position relative to upper left of window</p>\n","type":"Number","optional":true},{"name":"y","description":"<p>y-position relative to upper left of window</p>\n","type":"Number","optional":true}],"return":{"description":"","type":"Object/p5.Element"},"example":["\n <div><code class='norender'>\n function setup() {\n var 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 </code></div>"],"class":"p5.Element","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1277,"description":"<p>Sets the given style (css) property (1st arg) of the element with the\ngiven value (2nd arg). If a single argument is given, .style()\nreturns the value of the given property; however, if the single argument\nis given in css syntax (&#39;text-align:center&#39;), .style() sets the css\nappropriatly. .style() also handles 2d and 3d css transforms. If\nthe 1st arg is &#39;rotate&#39;, &#39;translate&#39;, or &#39;position&#39;, the following arguments\naccept Numbers as values. (&#39;translate&#39;, 10, 100, 50);</p>\n","itemtype":"method","name":"style","params":[{"name":"property","description":"<p>property to be set</p>\n","type":"String"},{"name":"value","description":"<p>value to assign to property</p>\n","type":"String|Number|p5.Color","optional":true},{"name":"value","description":"<p>value to assign to property (rotate/translate)</p>\n","type":"String|Number","optional":true},{"name":"value","description":"<p>value to assign to property (rotate/translate)</p>\n","type":"String|Number","optional":true},{"name":"value","description":"<p>value to assign to property (translate)</p>\n","type":"String|Number","optional":true}],"return":{"description":"value of property, if no value is specified\nor p5.Element","type":"String|Object/p5.Element"},"example":["\n<div><code class=\"norender\">\nvar myDiv = createDiv(\"I like pandas.\");\nmyDiv.style(\"font-size\", \"18px\");\nmyDiv.style(\"color\", \"#ff0000\");\n</code></div>\n<div><code class=\"norender\">\nvar col = color(25,23,200,50);\nvar button = createButton(\"button\");\nbutton.style(\"background-color\", col);\nbutton.position(10, 10);\n</code></div>\n<div><code class=\"norender\">\nvar myDiv = createDiv(\"I like lizards.\");\nmyDiv.style(\"position\", 20, 20);\nmyDiv.style(\"rotate\", 45);\n</code></div>\n<div><code class=\"norender\">\nvar myDiv;\nfunction setup() {\n background(200);\n myDiv = createDiv(\"I like gray.\");\n myDiv.position(20, 20);\n}\n\nfunction draw() {\n myDiv.style(\"font-size\", mouseX+\"px\");\n}\n</code></div>"],"class":"p5.Element","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1362,"description":"<p>Adds a new attribute or changes the value of an existing attribute\n on the specified element. If no value is specified, returns the\n value of the given attribute, or null if attribute is not set.</p>\n","itemtype":"method","name":"attribute","params":[{"name":"attr","description":"<p>attribute to set</p>\n","type":"String"},{"name":"value","description":"<p>value to assign to attribute</p>\n","type":"String","optional":true}],"return":{"description":"value of attribute, if no value is\n specified or p5.Element","type":"String|Object/p5.Element"},"example":["\n <div class=\"norender\"><code>\n var myDiv = createDiv(\"I like pandas.\");\n myDiv.attribute(\"align\", \"center\");\n </code></div>"],"class":"p5.Element","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1389,"description":"<p>Removes an attribute on the specified element.</p>\n","itemtype":"method","name":"removeAttribute","params":[{"name":"attr","description":"<p>attribute to remove</p>\n","type":"String"}],"return":{"description":"","type":"Object/p5.Element"},"example":["\n <div><code>\n var button;\n var checkbox;\nfunction setup() {\n checkbox = createCheckbox('enable', true);\n checkbox.changed(enableButton);\n button = createButton('button');\n button.position(10, 10);\n }\nfunction enableButton() {\n if( this.checked() ) {\n // Re-enable the button\n button.removeAttribute('disabled');\n } else {\n // Disable the button\n button.attribute('disabled','');\n }\n }\n </code></div>"],"class":"p5.Element","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1426,"description":"<p>Either returns the value of the element if no arguments\ngiven, or sets the value of the element.</p>\n","itemtype":"method","name":"value","params":[{"name":"value","description":"","type":"String|Number","optional":true}],"return":{"description":"value of element if no value is specified or p5.Element","type":"String|Object/p5.Element"},"example":["\n<div class='norender'><code>\n// gets the value\nvar inp;\nfunction setup() {\n inp = createInput('');\n}\n\nfunction mousePressed() {\n print(inp.value());\n}\n</code></div>\n<div class='norender'><code>\n// sets the value\nvar inp;\nfunction setup() {\n inp = createInput('myValue');\n}\n\nfunction mousePressed() {\n inp.value(\"myValue\");\n}\n</code></div>"],"class":"p5.Element","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1469,"description":"<p>Shows the current element. Essentially, setting display:block for the style.</p>\n","itemtype":"method","name":"show","return":{"description":"","type":"Object/p5.Element"},"example":["\n <div class='norender'><code>\n var div = createDiv('div');\n div.style(\"display\", \"none\");\n div.show(); // turns display to block\n </code></div>"],"class":"p5.Element","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1487,"description":"<p>Hides the current element. Essentially, setting display:none for the style.</p>\n","itemtype":"method","name":"hide","return":{"description":"","type":"Object/p5.Element"},"example":["\n<div class='norender'><code>\nvar div = createDiv('this is a div');\ndiv.hide();\n</code></div>"],"class":"p5.Element","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1503,"description":"<p>Sets the width and height of the element. AUTO can be used to\n only adjust one dimension. If no arguments given returns the width and height\n of the element in an object.</p>\n","itemtype":"method","name":"size","params":[{"name":"w","description":"<p>width of the element</p>\n","type":"Number","optional":true},{"name":"h","description":"<p>height of the element</p>\n","type":"Number","optional":true}],"return":{"description":"","type":"Object/p5.Element"},"example":["\n <div class='norender'><code>\n var div = createDiv('this is a div');\n div.size(100, 100);\n </code></div>"],"class":"p5.Element","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1569,"description":"<p>Removes the element and deregisters all listeners.</p>\n","itemtype":"method","name":"remove","example":["\n<div class='norender'><code>\nvar myDiv = createDiv('this is some text');\nmyDiv.remove();\n</code></div>"],"class":"p5.Element","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1618,"description":"<p>Path to the media element source.</p>\n","itemtype":"property","name":"src","return":{"description":"src","type":"String"},"class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1653,"description":"<p>Play an HTML5 media element.</p>\n","itemtype":"method","name":"play","return":{"description":"","type":"Object/p5.Element"},"class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1674,"description":"<p>Stops an HTML5 media element (sets current time to zero).</p>\n","itemtype":"method","name":"stop","return":{"description":"","type":"Object/p5.Element"},"class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1686,"description":"<p>Pauses an HTML5 media element.</p>\n","itemtype":"method","name":"pause","return":{"description":"","type":"Object/p5.Element"},"class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1697,"description":"<p>Set &#39;loop&#39; to true for an HTML5 media element, and starts playing.</p>\n","itemtype":"method","name":"loop","return":{"description":"","type":"Object/p5.Element"},"class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1708,"description":"<p>Set &#39;loop&#39; to false for an HTML5 media element. Element will stop\nwhen it reaches the end.</p>\n","itemtype":"method","name":"noLoop","return":{"description":"","type":"Object/p5.Element"},"class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1721,"description":"<p>Set HTML5 media element to autoplay or not.</p>\n","itemtype":"method","name":"autoplay","params":[{"name":"autoplay","description":"<p>whether the element should autoplay</p>\n","type":"Boolean"}],"return":{"description":"","type":"Object/p5.Element"},"class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1733,"description":"<p>Sets volume for this HTML5 media element. If no argument is given,\nreturns the current volume.</p>\n","params":[{"name":"val","description":"<p>volume between 0.0 and 1.0</p>\n","type":"Number","optional":true}],"return":{"description":"current volume or p5.MediaElement","type":"Number|p5.MediaElement"},"itemtype":"method","name":"volume","class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1749,"description":"<p>If no arguments are given, returns the current playback speed of the\nelement. The speed parameter sets the speed where 2.0 will play the\nelement twice as fast, 0.5 will play at half the speed, and -1 will play\nthe element in normal speed in reverse.(Note that not all browsers support\nbackward playback and even if they do, playback might not be smooth.)</p>\n","itemtype":"method","name":"speed","params":[{"name":"speed","description":"<p>speed multiplier for element playback</p>\n","type":"Number","optional":true}],"return":{"description":"current playback speed or p5.MediaElement","type":"Number|Object/p5.MediaElement"},"class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1768,"description":"<p>If no arguments are given, returns the current time of the element.\nIf an argument is given the current time of the element is set to it.</p>\n","itemtype":"method","name":"time","params":[{"name":"time","description":"<p>time to jump to (in seconds)</p>\n","type":"Number","optional":true}],"return":{"description":"current time (in seconds)\n or p5.MediaElement","type":"Number|Object/p5.MediaElement"},"class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1785,"description":"<p>Returns the duration of the HTML5 media element.</p>\n","itemtype":"method","name":"duration","return":{"description":"duration","type":"Number"},"class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1835,"description":"<p>Schedule an event to be called when the audio or video\nelement reaches the end. If the element is looping,\nthis will not be called. The element is passed in\nas the argument to the onended callback.</p>\n","itemtype":"method","name":"onended","params":[{"name":"callback","description":"<p>function to call when the\n soundfile has ended. The\n media element will be passed\n in as the argument to the\n callback.</p>\n","type":"Function"}],"return":{"description":"","type":"Object/p5.MediaElement"},"example":["\n<div><code>\nfunction setup() {\n audioEl = createAudio('assets/beat.mp3');\n audioEl.showControls(true);\n audioEl.onended(sayDone);\n}\n\nfunction sayDone(elt) {\n alert('done playing ' + elt.src );\n}\n</code></div>"],"class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1867,"class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1869,"description":"<p>Send the audio output of this element to a specified audioNode or\np5.sound object. If no element is provided, connects to p5&#39;s master\noutput. That connection is established when this method is first called.\nAll connections are removed by the .disconnect() method.</p>\n<p>This method is meant to be used with the p5.sound.js addon library.</p>\n","itemtype":"method","name":"connect","params":[{"name":"audioNode","description":"<p>AudioNode from the Web Audio API,\nor an object from the p5.sound library</p>\n","type":"AudioNode|p5.sound object"}],"class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1921,"description":"<p>Disconnect all Web Audio routing, including to master output.\nThis is useful if you want to re-route the output through\naudio effects, for example.</p>\n","itemtype":"method","name":"disconnect","class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1937,"class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1939,"description":"<p>Show the default MediaElement controls, as determined by the web browser.</p>\n","itemtype":"method","name":"showControls","class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1950,"description":"<p>Hide the default mediaElement controls.</p>\n","itemtype":"method","name":"hideControls","class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1959,"class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":1961,"description":"<p>Schedule events to trigger every time a MediaElement\n(audio/video) reaches a playback cue point.</p>\n<p>Accepts a callback function, a time (in seconds) at which to trigger\nthe callback, and an optional parameter for the callback.</p>\n<p>Time will be passed as the first parameter to the callback function,\nand param will be the second parameter.</p>\n","itemtype":"method","name":"addCue","params":[{"name":"time","description":"<p>Time in seconds, relative to this media\n element&#39;s playback. For example, to trigger\n an event every time playback reaches two\n seconds, pass in the number 2. This will be\n passed as the first parameter to\n the callback function.</p>\n","type":"Number"},{"name":"callback","description":"<p>Name of a function that will be\n called at the given time. The callback will\n receive time and (optionally) param as its\n two parameters.</p>\n","type":"Function"},{"name":"value","description":"<p>An object to be passed as the\n second parameter to the\n callback function.</p>\n","type":"Object","optional":true}],"return":{"description":"id ID of this cue,\n useful for removeCue(id)","type":"Number"},"example":["\n<div><code>\nfunction setup() {\n background(255,255,255);\n\n audioEl = createAudio('assets/beat.mp3');\n audioEl.showControls();\n\n // schedule three calls to changeBackground\n audioEl.addCue(0.5, changeBackground, color(255,0,0) );\n audioEl.addCue(1.0, changeBackground, color(0,255,0) );\n audioEl.addCue(2.5, changeBackground, color(0,0,255) );\n audioEl.addCue(3.0, changeBackground, color(0,255,255) );\n audioEl.addCue(4.2, changeBackground, color(255,255,0) );\n audioEl.addCue(5.0, changeBackground, color(255,255,0) );\n}\n\nfunction changeBackground(val) {\n background(val);\n}\n</code></div>"],"class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":2023,"description":"<p>Remove a callback based on its ID. The ID is returned by the\naddCue method.</p>\n","itemtype":"method","name":"removeCue","params":[{"name":"id","description":"<p>ID of the cue, as returned by addCue</p>\n","type":"Number"}],"class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":2043,"description":"<p>Remove all of the callbacks that had originally been scheduled\nvia the addCue method.</p>\n","itemtype":"method","name":"clearCues","class":"p5.MediaElement","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":2100,"description":"<p>Underlying File object. All normal File methods can be called on this.</p>\n","itemtype":"property","name":"file","class":"p5.File","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":2112,"description":"<p>File type (image, text, etc.)</p>\n","itemtype":"property","name":"type","class":"p5.File","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":2118,"description":"<p>File subtype (usually the file extension jpg, png, xml, etc.)</p>\n","itemtype":"property","name":"subtype","class":"p5.File","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":2124,"description":"<p>File name</p>\n","itemtype":"property","name":"name","class":"p5.File","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":2130,"description":"<p>File size</p>\n","itemtype":"property","name":"size","class":"p5.File","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.dom.js","line":2137,"description":"<p>URL string containing image data.</p>\n","itemtype":"property","name":"data","class":"p5.File","module":"p5.dom","submodule":"p5.dom"},{"file":"lib/addons/p5.sound.js","line":53,"description":"<p>p5.sound developed by Jason Sigal for the Processing Foundation, Google Summer of Code 2014. The MIT License (MIT).</p>\n<p><a href=\"http://github.com/therewasaguy/p5.sound\">http://github.com/therewasaguy/p5.sound</a></p>\n<p>Some of the many audio libraries &amp; resources that inspire p5.sound:</p>\n<ul>\n<li>TONE.js (c) Yotam Mann, 2014. Licensed under The MIT License (MIT). <a href=\"https://github.com/TONEnoTONE/Tone.js\">https://github.com/TONEnoTONE/Tone.js</a></li>\n<li>buzz.js (c) Jay Salvat, 2013. Licensed under The MIT License (MIT). <a href=\"http://buzz.jaysalvat.com/\">http://buzz.jaysalvat.com/</a></li>\n<li>Boris Smus Web Audio API book, 2013. Licensed under the Apache License <a href=\"http://www.apache.org/licenses/LICENSE-2.0\">http://www.apache.org/licenses/LICENSE-2.0</a></li>\n<li>wavesurfer.js <a href=\"https://github.com/katspaugh/wavesurfer.js\">https://github.com/katspaugh/wavesurfer.js</a></li>\n<li>Web Audio Components by Jordan Santell <a href=\"https://github.com/web-audio-components\">https://github.com/web-audio-components</a></li>\n<li><p>Wilm Thoben&#39;s Sound library for Processing <a href=\"https://github.com/processing/processing/tree/master/java/libraries/sound\">https://github.com/processing/processing/tree/master/java/libraries/sound</a></p>\n<p>Web Audio API: <a href=\"http://w3.org/TR/webaudio/\">http://w3.org/TR/webaudio/</a></p>\n</li>\n</ul>\n","class":"p5.sound","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":207,"description":"<p>Returns the Audio Context for this sketch. Useful for users\nwho would like to dig deeper into the <a target='_blank' href=\n'http://webaudio.github.io/web-audio-api/'>Web Audio API\n</a>.</p>","itemtype":"method","name":"getAudioContext","return":{"description":"AudioContext for this sketch","type":"Object"},"class":"p5.sound","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":221,"description":"<p>Determine which filetypes are supported (inspired by buzz.js)\nThe audio element (el) will only be used to test browser support for various audio formats</p>\n","class":"p5.sound","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":288,"description":"<p>Master contains AudioContext and the master sound output.</p>\n","class":"p5.sound","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":323,"description":"<p>Returns a number representing the master amplitude (volume) for sound \nin this sketch.</p>\n","itemtype":"method","name":"getMasterVolume","return":{"description":"Master amplitude (volume) for sound in this sketch.\n Should be between 0.0 (silence) and 1.0.","type":"Number"},"class":"p5.sound","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":334,"description":"<p>Scale the output of all sound in this sketch</p>\nScaled between 0.0 (silence) and 1.0 (full volume).\n1.0 is the maximum amplitude of a digital sound, so multiplying\nby greater than 1.0 may cause digital distortion. To\nfade, provide a <code>rampTime</code> parameter. For more\ncomplex fades, see the Env class.\n\nAlternately, you can pass in a signal source such as an\noscillator to modulate the amplitude with an audio signal.\n\n<p><b>How This Works</b>: When you load the p5.sound module, it\ncreates a single instance of p5sound. All sound objects in this\nmodule output to p5sound before reaching your computer&#39;s output.\nSo if you change the amplitude of p5sound, it impacts all of the\nsound in this module.</p>\n\n<p>If no value is provided, returns a Web Audio API Gain Node</p>","itemtype":"method","name":"masterVolume","params":[{"name":"volume","description":"<p>Volume (amplitude) between 0.0\n and 1.0 or modulating signal/oscillator</p>\n","type":"Number|Object"},{"name":"rampTime","description":"<p>Fade for t seconds</p>\n","type":"Number","optional":true},{"name":"timeFromNow","description":"<p>Schedule this event to happen at\n t seconds in the future</p>\n","type":"Number","optional":true}],"class":"p5.sound","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":376,"description":"<p>p5.soundOut is the p5.sound master output. It sends output to\nthe destination of this window&#39;s web audio context. It contains \nWeb Audio API nodes including a dyanmicsCompressor (<code>.limiter</code>),\nand Gain Nodes for <code>.input</code> and <code>.output</code>.</p>\n","itemtype":"property","name":"p5.soundOut","type":"{Object}","class":"p5.sound","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":386,"description":"<p>a silent connection to the DesinationNode\nwhich will ensure that anything connected to it\nwill not be garbage collected</p>\n","access":"private","tagname":"","class":"p5.sound","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":402,"description":"<p>Returns a number representing the sample rate, in samples per second,\nof all sound objects in this audio context. It is determined by the\nsampling rate of your operating system&#39;s sound card, and it is not\ncurrently possile to change.\nIt is often 44100, or twice the range of human hearing.</p>\n","itemtype":"method","name":"sampleRate","return":{"description":"samplerate samples per second","type":"Number"},"class":"p5.sound","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":415,"description":"<p>Returns the closest MIDI note value for\na given frequency.</p>\n","params":[{"name":"frequency","description":"<p>A freqeuncy, for example, the &quot;A&quot;\n above Middle C is 440Hz</p>\n","type":"Number"}],"return":{"description":"MIDI note value","type":"Number"},"class":"p5.sound","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":428,"description":"<p>Returns the frequency value of a MIDI note value.\nGeneral MIDI treats notes as integers where middle C\nis 60, C# is 61, D is 62 etc. Useful for generating\nmusical frequencies with oscillators.</p>\n","itemtype":"method","name":"midiToFreq","params":[{"name":"midiNote","description":"<p>The number of a MIDI note</p>\n","type":"Number"}],"return":{"description":"Frequency value of the given MIDI note","type":"Number"},"example":["\n<div><code>\nvar notes = [60, 64, 67, 72];\nvar i = 0;\n\nfunction setup() {\n osc = new p5.Oscillator('Triangle');\n osc.start();\n frameRate(1);\n}\n\nfunction draw() {\n var freq = midiToFreq(notes[i]);\n osc.freq(freq);\n i++;\n if (i >= notes.length){\n i = 0;\n }\n}\n</code></div>"],"class":"p5.sound","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":461,"description":"<p>List the SoundFile formats that you will include. LoadSound \nwill search your directory for these extensions, and will pick\na format that is compatable with the client&#39;s web browser.\n<a href=\"http://media.io/\">Here</a> is a free online file\nconverter.</p>\n","itemtype":"method","name":"soundFormats","params":[{"name":"formats","description":"<p>i.e. &#39;mp3&#39;, &#39;wav&#39;, &#39;ogg&#39;</p>\n","type":"String|Strings"}],"example":["\n<div><code>\nfunction preload() {\n // set the global sound formats\n soundFormats('mp3', 'ogg');\n \n // load either beatbox.mp3, or .ogg, depending on browser\n mySound = loadSound('../sounds/beatbox.mp3');\n}\n\nfunction setup() {\n mySound.play();\n}\n</code></div>"],"class":"p5.sound","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":575,"description":"<p>Used by Osc and Env to chain signal math</p>\n","class":"p5.sound","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":599,"description":"<p>Helper function to generate an error\nwith a custom stack trace that points to the sketch\nand removes other parts of the stack trace.</p>\n","access":"private","tagname":"","itemtype":"property","name":"{String} failedPath path to the file that failed to load","type":"String","return":{"description":"returns a custom Error object","type":"Error"},"class":"p5.sound","module":"p5.sound","submodule":"p5.sound","subprops":[{"name":"name","description":"custom error name","type":"String"},{"name":"errorTrace","description":"custom error trace","type":"String"},{"name":"failedPath","description":"path to the file that failed to load","type":"String"}]},{"file":"lib/addons/p5.sound.js","line":851,"description":"<p>loadSound() returns a new p5.SoundFile from a specified\npath. If called during preload(), the p5.SoundFile will be ready\nto play in time for setup() and draw(). If called outside of\npreload, the p5.SoundFile will not be ready immediately, so\nloadSound accepts a callback as the second parameter. Using a\n<a href=\"https://github.com/processing/p5.js/wiki/Local-server\">\nlocal server</a> is recommended when loading external files.</p>\n","itemtype":"method","name":"loadSound","params":[{"name":"path","description":"<p>Path to the sound file, or an array with\n paths to soundfiles in multiple formats\n i.e. [&#39;sound.ogg&#39;, &#39;sound.mp3&#39;].\n Alternately, accepts an object: either\n from the HTML5 File API, or a p5.File.</p>\n","type":"String/Array"},{"name":"successCallback","description":"<p>Name of a function to call once file loads</p>\n","type":"Function","optional":true},{"name":"errorCallback","description":"<p>Name of a function to call if there is\n an error loading the file.</p>\n","type":"Function","optional":true},{"name":"whileLoading","description":"<p>Name of a function to call while file is loading.\n This function will receive the percentage loaded\n so far, from 0.0 to 1.0.</p>\n","type":"Function","optional":true}],"return":{"description":"Returns a p5.SoundFile","type":"SoundFile"},"example":[" \n<div><code>\nfunction preload() {\n mySound = loadSound('assets/doorbell.mp3');\n}\n\nfunction setup() {\n mySound.setVolume(0.1);\n mySound.play();\n}\n</code></div>"],"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":893,"description":"<p>This is a helper function that the p5.SoundFile calls to load\nitself. Accepts a callback (the name of another function)\nas an optional parameter.</p>\n","access":"private","tagname":"","params":[{"name":"successCallback","description":"<p>Name of a function to call once file loads</p>\n","type":"Function","optional":true},{"name":"errorCallback","description":"<p>Name of a function to call if there is an error</p>\n","type":"Function","optional":true}],"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":986,"description":"<p>Returns true if the sound file finished loading successfully.</p>\n","itemtype":"method","name":"isLoaded","return":{"description":"","type":"Boolean"},"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":999,"description":"<p>Play the p5.SoundFile</p>\n","itemtype":"method","name":"play","params":[{"name":"startTime","description":"<p>(optional) schedule playback to start (in seconds from now).</p>\n","type":"Number","optional":true},{"name":"rate","description":"<p>(optional) playback rate</p>\n","type":"Number","optional":true},{"name":"amp","description":"<p>(optional) amplitude (volume)\n of playback</p>\n","type":"Number","optional":true},{"name":"cueStart","description":"<p>(optional) cue start time in seconds</p>\n","type":"Number","optional":true},{"name":"duration","description":"<p>(optional) duration of playback in seconds</p>\n","type":"Number","optional":true}],"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1111,"description":"<p>p5.SoundFile has two play modes: <code>restart</code> and\n<code>sustain</code>. Play Mode determines what happens to a\np5.SoundFile if it is triggered while in the middle of playback.\nIn sustain mode, playback will continue simultaneous to the\nnew playback. In restart mode, play() will stop playback\nand start over. Sustain is the default mode.</p>\n","itemtype":"method","name":"playMode","params":[{"name":"str","description":"<p>&#39;restart&#39; or &#39;sustain&#39;</p>\n","type":"String"}],"example":["\n<div><code>\nfunction setup(){\n mySound = loadSound('assets/Damscray_DancingTiger.mp3');\n}\nfunction mouseClicked() {\n mySound.playMode('sustain');\n mySound.play();\n}\nfunction keyPressed() {\n mySound.playMode('restart');\n mySound.play();\n}\n \n </code></div>"],"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1153,"description":"<p>Pauses a file that is currently playing. If the file is not\nplaying, then nothing will happen.</p>\n<p>After pausing, .play() will resume from the paused\nposition.\nIf p5.SoundFile had been set to loop before it was paused,\nit will continue to loop after it is unpaused with .play().</p>\n","itemtype":"method","name":"pause","params":[{"name":"startTime","description":"<p>(optional) schedule event to occur\n seconds from now</p>\n","type":"Number","optional":true}],"example":["\n<div><code>\nvar soundFile;\n\nfunction preload() {\n soundFormats('ogg', 'mp3');\n soundFile = loadSound('assets/Damscray_-_Dancing_Tiger_02.mp3');\n}\nfunction setup() {\n background(0, 255, 0);\n soundFile.setVolume(0.1);\n soundFile.loop();\n}\nfunction keyTyped() {\n if (key == 'p') {\n soundFile.pause();\n background(255, 0, 0);\n }\n}\n\nfunction keyReleased() {\n if (key == 'p') {\n soundFile.play();\n background(0, 255, 0);\n }\n</code>\n</div>"],"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1208,"description":"<p>Loop the p5.SoundFile. Accepts optional parameters to set the\nplayback rate, playback volume, loopStart, loopEnd.</p>\n","itemtype":"method","name":"loop","params":[{"name":"startTime","description":"<p>(optional) schedule event to occur\n seconds from now</p>\n","type":"Number","optional":true},{"name":"rate","description":"<p>(optional) playback rate</p>\n","type":"Number","optional":true},{"name":"amp","description":"<p>(optional) playback volume</p>\n","type":"Number","optional":true},{"name":"cueLoopStart","description":"<p>startTime in seconds</p>\n","type":"Number","optional":true},{"name":"duration","description":"<p>(optional) loop duration in seconds</p>\n","type":"Number","optional":true}],"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1224,"description":"<p>Set a p5.SoundFile&#39;s looping flag to true or false. If the sound\nis currently playing, this change will take effect when it\nreaches the end of the current playback.</p>\n","params":[{"name":"Boolean","description":"<p>set looping to true or false</p>\n","type":"Boolean"}],"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1244,"description":"<p>Returns &#39;true&#39; if a p5.SoundFile is currently looping and playing, &#39;false&#39; if not.</p>\n","return":{"description":"","type":"Boolean"},"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1258,"description":"<p>Returns true if a p5.SoundFile is playing, false if not (i.e.\npaused or stopped).</p>\n","itemtype":"method","name":"isPlaying","return":{"description":"","type":"Boolean"},"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1268,"description":"<p>Returns true if a p5.SoundFile is paused, false if not (i.e.\nplaying or stopped).</p>\n","itemtype":"method","name":"isPaused","return":{"description":"","type":"Boolean"},"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1278,"description":"<p>Stop soundfile playback.</p>\n","itemtype":"method","name":"stop","params":[{"name":"startTime","description":"<p>(optional) schedule event to occur\n in seconds from now</p>\n","type":"Number","optional":true}],"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1302,"description":"<p>Stop playback on all of this soundfile&#39;s sources.</p>\n","access":"private","tagname":"","class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1324,"description":"<p>Multiply the output volume (amplitude) of a sound file\nbetween 0.0 (silence) and 1.0 (full volume).\n1.0 is the maximum amplitude of a digital sound, so multiplying\nby greater than 1.0 may cause digital distortion. To\nfade, provide a <code>rampTime</code> parameter. For more\ncomplex fades, see the Env class.</p>\n<p>Alternately, you can pass in a signal source such as an\noscillator to modulate the amplitude with an audio signal.</p>\n","itemtype":"method","name":"setVolume","params":[{"name":"volume","description":"<p>Volume (amplitude) between 0.0\n and 1.0 or modulating signal/oscillator</p>\n","type":"Number|Object"},{"name":"rampTime","description":"<p>Fade for t seconds</p>\n","type":"Number","optional":true},{"name":"timeFromNow","description":"<p>Schedule this event to happen at\n t seconds in the future</p>\n","type":"Number","optional":true}],"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1365,"description":"<p>Set the stereo panning of a p5.sound object to\na floating point number between -1.0 (left) and 1.0 (right).\nDefault is 0.0 (center).</p>\n","itemtype":"method","name":"pan","params":[{"name":"panValue","description":"<p>Set the stereo panner</p>\n","type":"Number","optional":true},{"name":"timeFromNow","description":"<p>schedule this event to happen\n seconds from now</p>\n","type":"Number"}],"example":["\n<div><code>\n\n var ball = {};\n var soundFile;\n\n function setup() {\n soundFormats('ogg', 'mp3');\n soundFile = loadSound('assets/beatbox.mp3');\n }\n \n function draw() {\n background(0);\n ball.x = constrain(mouseX, 0, width);\n ellipse(ball.x, height/2, 20, 20)\n }\n \n function mousePressed(){\n // map the ball's x location to a panning degree \n // between -1.0 (left) and 1.0 (right)\n var panning = map(ball.x, 0., width,-1.0, 1.0);\n soundFile.pan(panning);\n soundFile.play();\n }\n </div></code>"],"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1404,"description":"<p>Returns the current stereo pan position (-1.0 to 1.0)</p>\n","return":{"description":"Returns the stereo pan setting of the Oscillator\n as a number between -1.0 (left) and 1.0 (right).\n 0.0 is center and default.","type":"Number"},"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1414,"description":"<p>Set the playback rate of a sound file. Will change the speed and the pitch.\nValues less than zero will reverse the audio buffer.</p>\n","itemtype":"method","name":"rate","params":[{"name":"playbackRate","description":"<p>Set the playback rate. 1.0 is normal,\n .5 is half-speed, 2.0 is twice as fast.\n Must be greater than zero.</p>\n","type":"Number","optional":true}],"example":["\n<div><code>\nvar song;\n\nfunction preload() {\n song = loadSound('assets/Damscray_DancingTiger.mp3');\n}\n\nfunction setup() {\n song.loop();\n}\n\nfunction draw() {\n background(200);\n \n // Set the rate to a range between 0.1 and 4\n // Changing the rate also alters the pitch\n var speed = map(mouseY, 0.1, height, 0, 2);\n speed = constrain(speed, 0.01, 4);\n song.rate(speed);\n \n // Draw a circle to show what is going on\n stroke(0);\n fill(51, 100);\n ellipse(mouseX, 100, 48, 48);\n}\n\n </code>\n </div>\n"],"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1491,"description":"<p>Returns the duration of a sound file in seconds.</p>\n","itemtype":"method","name":"duration","return":{"description":"The duration of the soundFile in seconds.","type":"Number"},"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1505,"description":"<p>Return the current position of the p5.SoundFile playhead, in seconds.\nNote that if you change the playbackRate while the p5.SoundFile is\nplaying, the results may not be accurate.</p>\n","itemtype":"method","name":"currentTime","return":{"description":"currentTime of the soundFile in seconds.","type":"Number"},"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1521,"description":"<p>Move the playhead of the song to a position, in seconds. Start\nand Stop time. If none are given, will reset the file to play\nentire duration from start to finish.</p>\n","itemtype":"method","name":"jump","params":[{"name":"cueTime","description":"<p>cueTime of the soundFile in seconds.</p>\n","type":"Number"},{"name":"uuration","description":"<p>duration in seconds.</p>\n","type":"Number"}],"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1544,"description":"<p>Return the number of channels in a sound file.\nFor example, Mono = 1, Stereo = 2.</p>\n","itemtype":"method","name":"channels","return":{"description":"[channels]","type":"Number"},"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1554,"description":"<p>Return the sample rate of the sound file.</p>\n","itemtype":"method","name":"sampleRate","return":{"description":"[sampleRate]","type":"Number"},"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1563,"description":"<p>Return the number of samples in a sound file.\nEqual to sampleRate * duration.</p>\n","itemtype":"method","name":"frames","return":{"description":"[sampleCount]","type":"Number"},"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1573,"description":"<p>Returns an array of amplitude peaks in a p5.SoundFile that can be\nused to draw a static waveform. Scans through the p5.SoundFile&#39;s\naudio buffer to find the greatest amplitudes. Accepts one\nparameter, &#39;length&#39;, which determines size of the array.\nLarger arrays result in more precise waveform visualizations.</p>\n<p>Inspired by Wavesurfer.js.</p>\n","itemtype":"method","name":"getPeaks","params":[{"name":"length","description":"<p>length is the size of the returned array.\n Larger length results in more precision.\n Defaults to 5*width of the browser window.</p>\n","type":"Number","optional":true}],"return":{"description":"Array of peaks.","type":"Float32Array"},"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1625,"description":"<p>Reverses the p5.SoundFile&#39;s buffer source.\nPlayback must be handled separately (see example).</p>\n","itemtype":"method","name":"reverseBuffer","example":["\n<div><code>\nvar drum;\n\nfunction preload() {\n drum = loadSound('assets/drum.mp3');\n}\n\nfunction setup() {\n drum.reverseBuffer();\n drum.play();\n}\n\n </code>\n </div>"],"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1662,"description":"<p>Schedule an event to be called when the soundfile\nreaches the end of a buffer. If the soundfile is\nplaying through once, this will be called when it\nends. If it is looping, it will be called when\nstop is called.</p>\n","itemtype":"method","name":"onended","params":[{"name":"callback","description":"<p>function to call when the\n soundfile has ended.</p>\n","type":"Function"}],"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1714,"description":"<p>Connects the output of a p5sound object to input of another\np5.sound object. For example, you may connect a p5.SoundFile to an\nFFT or an Effect. If no parameter is given, it will connect to\nthe master output. Most p5sound objects connect to the master\noutput when they are created.</p>\n","itemtype":"method","name":"connect","params":[{"name":"object","description":"<p>Audio object that accepts an input</p>\n","type":"Object","optional":true}],"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1735,"description":"<p>Disconnects the output of this p5sound object.</p>\n","itemtype":"method","name":"disconnect","class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1743,"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1748,"description":"<p>Reset the source for this SoundFile to a\nnew path (URL).</p>\n","itemtype":"method","name":"setPath","params":[{"name":"path","description":"<p>path to audio file</p>\n","type":"String"},{"name":"callback","description":"<p>Callback</p>\n","type":"Function"}],"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1761,"description":"<p>Replace the current Audio Buffer with a new Buffer.</p>\n","params":[{"name":"buf","description":"<p>Array of Float32 Array(s). 2 Float32 Arrays\n will create a stereo source. 1 will create\n a mono source.</p>\n","type":"Array"}],"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":1834,"description":"<p>processPeaks returns an array of timestamps where it thinks there is a beat.</p>\n<p>This is an asynchronous function that processes the soundfile in an offline audio context,\nand sends the results to your callback function.</p>\n<p>The process involves running the soundfile through a lowpass filter, and finding all of the\npeaks above the initial threshold. If the total number of peaks are below the minimum number of peaks,\nit decreases the threshold and re-runs the analysis until either minPeaks or minThreshold are reached.</p>\n","itemtype":"method","name":"processPeaks","params":[{"name":"callback","description":"<p>a function to call once this data is returned</p>\n","type":"Function"},{"name":"initThreshold","description":"<p>initial threshold defaults to 0.9</p>\n","type":"Number","optional":true},{"name":"minThreshold","description":"<p>minimum threshold defaults to 0.22</p>\n","type":"Number","optional":true},{"name":"minPeaks","description":"<p>minimum number of peaks defaults to 200</p>\n","type":"Number","optional":true}],"return":{"description":"Array of timestamped peaks","type":"Array"},"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":2027,"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":2028,"description":"<p>Schedule events to trigger every time a MediaElement\n(audio/video) reaches a playback cue point.</p>\n<p>Accepts a callback function, a time (in seconds) at which to trigger\nthe callback, and an optional parameter for the callback.</p>\n<p>Time will be passed as the first parameter to the callback function,\nand param will be the second parameter.</p>\n","itemtype":"method","name":"addCue","params":[{"name":"time","description":"<p>Time in seconds, relative to this media\n element&#39;s playback. For example, to trigger\n an event every time playback reaches two\n seconds, pass in the number 2. This will be\n passed as the first parameter to\n the callback function.</p>\n","type":"Number"},{"name":"callback","description":"<p>Name of a function that will be\n called at the given time. The callback will\n receive time and (optionally) param as its\n two parameters.</p>\n","type":"Function"},{"name":"value","description":"<p>An object to be passed as the\n second parameter to the\n callback function.</p>\n","type":"Object","optional":true}],"return":{"description":"id ID of this cue,\n useful for removeCue(id)","type":"Number"},"example":["\n<div><code>\nfunction setup() {\n background(0);\n noStroke();\n fill(255);\n textAlign(CENTER);\n text('click to play', width/2, height/2);\n \n mySound = loadSound('assets/beat.mp3');\n\n // schedule calls to changeText\n mySound.addCue(0.50, changeText, \"hello\" );\n mySound.addCue(1.00, changeText, \"p5\" );\n mySound.addCue(1.50, changeText, \"what\" );\n mySound.addCue(2.00, changeText, \"do\" );\n mySound.addCue(2.50, changeText, \"you\" );\n mySound.addCue(3.00, changeText, \"want\" );\n mySound.addCue(4.00, changeText, \"to\" );\n mySound.addCue(5.00, changeText, \"make\" );\n mySound.addCue(6.00, changeText, \"?\" );\n}\n\nfunction changeText(val) {\n background(0);\n text(val, width/2, height/2);\n}\n\nfunction mouseClicked() {\n if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n if (mySound.isPlaying() ) {\n mySound.stop();\n } else {\n mySound.play();\n }\n }\n}\n</code></div>"],"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":2103,"description":"<p>Remove a callback based on its ID. The ID is returned by the\naddCue method.</p>\n","itemtype":"method","name":"removeCue","params":[{"name":"id","description":"<p>ID of the cue, as returned by addCue</p>\n","type":"Number"}],"class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":2121,"description":"<p>Remove all of the callbacks that had originally been scheduled\nvia the addCue method.</p>\n","itemtype":"method","name":"clearCues","class":"p5.SoundFile","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":2238,"description":"<p>Connects to the p5sound instance (master output) by default.\nOptionally, you can pass in a specific source (i.e. a soundfile).</p>\n","itemtype":"method","name":"setInput","params":[{"name":"snd","description":"<p>set the sound source\n (optional, defaults to\n master output)</p>\n","type":"SoundObject|undefined","optional":true},{"name":"smoothing","description":"<p>a range between 0.0 and 1.0\n to smooth amplitude readings</p>\n","type":"Number|undefined","optional":true}],"example":["\n<div><code>\nfunction preload(){\n sound1 = loadSound('assets/beat.mp3');\n sound2 = loadSound('assets/drum.mp3');\n}\nfunction setup(){\n amplitude = new p5.Amplitude();\n sound1.play();\n sound2.play();\n amplitude.setInput(sound2);\n}\nfunction draw() {\n background(0);\n fill(255);\n var level = amplitude.getLevel();\n var size = map(level, 0, 1, 0, 200);\n ellipse(width/2, height/2, size, size);\n}\nfunction mouseClicked(){\n sound1.stop();\n sound2.stop();\n}\n</code></div>"],"class":"p5.Amplitude","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":2343,"description":"<p>Returns a single Amplitude reading at the moment it is called.\nFor continuous readings, run in the draw loop.</p>\n","itemtype":"method","name":"getLevel","params":[{"name":"channel","description":"<p>Optionally return only channel 0 (left) or 1 (right)</p>\n","type":"Number","optional":true}],"return":{"description":"Amplitude as a number between 0.0 and 1.0","type":"Number"},"example":["\n<div><code>\nfunction preload(){\n sound = loadSound('assets/beat.mp3');\n}\nfunction setup() { \n amplitude = new p5.Amplitude();\n sound.play();\n}\nfunction draw() {\n background(0);\n fill(255);\n var level = amplitude.getLevel();\n var size = map(level, 0, 1, 0, 200);\n ellipse(width/2, height/2, size, size);\n}\nfunction mouseClicked(){\n sound.stop();\n}\n</code></div>"],"class":"p5.Amplitude","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":2384,"description":"<p>Determines whether the results of Amplitude.process() will be\nNormalized. To normalize, Amplitude finds the difference the\nloudest reading it has processed and the maximum amplitude of\n1.0. Amplitude adds this difference to all values to produce\nresults that will reliably map between 0.0 and 1.0. However,\nif a louder moment occurs, the amount that Normalize adds to\nall the values will change. Accepts an optional boolean parameter\n(true or false). Normalizing is off by default.</p>\n","itemtype":"method","name":"toggleNormalize","params":[{"name":"boolean","description":"<p>set normalize to true (1) or false (0)</p>\n","type":"Boolean","optional":true}],"class":"p5.Amplitude","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":2404,"description":"<p>Smooth Amplitude analysis by averaging with the last analysis \nframe. Off by default.</p>\n","itemtype":"method","name":"smooth","params":[{"name":"set","description":"<p>smoothing from 0.0 &lt;= 1</p>\n","type":"Number"}],"class":"p5.Amplitude","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":2554,"description":"<p>Set the input source for the FFT analysis. If no source is\nprovided, FFT will analyze all sound in the sketch.</p>\n","itemtype":"method","name":"setInput","params":[{"name":"source","description":"<p>p5.sound object (or web audio API source node)</p>\n","type":"Object","optional":true}],"class":"p5.FFT","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":2573,"description":"<p>Returns an array of amplitude values (between -1.0 and +1.0) that represent\na snapshot of amplitude readings in a single buffer. Length will be\nequal to bins (defaults to 1024). Can be used to draw the waveform\nof a sound.</p>\n","itemtype":"method","name":"waveform","params":[{"name":"bins","description":"<p>Must be a power of two between\n 16 and 1024. Defaults to 1024.</p>\n","type":"Number","optional":true},{"name":"precision","description":"<p>If any value is provided, will return results\n in a Float32 Array which is more precise\n than a regular array.</p>\n","type":"String","optional":true}],"return":{"description":"Array Array of amplitude values (-1 to 1)\n over time. Array length = bins.","type":"Array"},"class":"p5.FFT","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":2616,"description":"<p>Returns an array of amplitude values (between 0 and 255)\nacross the frequency spectrum. Length is equal to FFT bins\n(1024 by default). The array indices correspond to frequencies\n(i.e. pitches), from the lowest to the highest that humans can\nhear. Each value represents amplitude at that slice of the\nfrequency spectrum. Must be called prior to using\n<code>getEnergy()</code>.</p>\n","itemtype":"method","name":"analyze","params":[{"name":"bins","description":"<p>Must be a power of two between\n 16 and 1024. Defaults to 1024.</p>\n","type":"Number","optional":true},{"name":"scale","description":"<p>If &quot;dB,&quot; returns decibel\n float measurements between\n -140 and 0 (max).\n Otherwise returns integers from 0-255.</p>\n","type":"Number","optional":true}],"return":{"description":"spectrum Array of energy (amplitude/volume)\n values across the frequency spectrum.\n Lowest energy (silence) = 0, highest\n possible is 255.","type":"Array"},"example":["\n<div><code>\nvar osc;\nvar fft;\n\nfunction setup(){\n createCanvas(100,100);\n osc = new p5.Oscillator();\n osc.amp(0);\n osc.start();\n fft = new p5.FFT();\n}\n\nfunction draw(){\n background(0);\n\n var freq = map(mouseX, 0, 800, 20, 15000);\n freq = constrain(freq, 1, 20000);\n osc.freq(freq);\n\n var spectrum = fft.analyze(); \n noStroke();\n fill(0,255,0); // spectrum is green\n for (var i = 0; i< spectrum.length; i++){\n var x = map(i, 0, spectrum.length, 0, width);\n var h = -height + map(spectrum[i], 0, 255, height, 0);\n rect(x, height, width / spectrum.length, h );\n }\n\n stroke(255);\n text('Freq: ' + round(freq)+'Hz', 10, 10); \n\n isMouseOverCanvas();\n}\n\n// only play sound when mouse is over canvas\nfunction isMouseOverCanvas() {\n var mX = mouseX, mY = mouseY;\n if (mX > 0 && mX < width && mY < height && mY > 0) {\n osc.amp(0.5, 0.2);\n } else {\n osc.amp(0, 0.2);\n }\n}\n</code></div>\n \n"],"class":"p5.FFT","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":2708,"description":"<p>Returns the amount of energy (volume) at a specific\n<a href=\"en.wikipedia.org/wiki/Audio_frequency\" target=\"_blank\">\nfrequency</a>, or the average amount of energy between two\nfrequencies. Accepts Number(s) corresponding\nto frequency (in Hz), or a String corresponding to predefined\nfrequency ranges (&quot;bass&quot;, &quot;lowMid&quot;, &quot;mid&quot;, &quot;highMid&quot;, &quot;treble&quot;).\nReturns a range between 0 (no energy/volume at that frequency) and\n255 (maximum energy). \n<em>NOTE: analyze() must be called prior to getEnergy(). Analyze()\ntells the FFT to analyze frequency data, and getEnergy() uses\nthe results determine the value at a specific frequency or\nrange of frequencies.</em></p></p>\n","itemtype":"method","name":"getEnergy","params":[{"name":"frequency1","description":"<p>Will return a value representing\n energy at this frequency. Alternately,\n the strings &quot;bass&quot;, &quot;lowMid&quot; &quot;mid&quot;,\n &quot;highMid&quot;, and &quot;treble&quot; will return\n predefined frequency ranges.</p>\n","type":"Number|String"},{"name":"frequency2","description":"<p>If a second frequency is given,\n will return average amount of\n energy that exists between the\n two frequencies.</p>\n","type":"Number","optional":true}],"return":{"description":"Energy Energy (volume/amplitude) from\n 0 and 255.","type":"Number"},"class":"p5.FFT","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":2788,"description":"<p>Returns the \n<a href=\"http://en.wikipedia.org/wiki/Spectral_centroid\" target=\"_blank\">\nspectral centroid</a> of the input signal.\n<em>NOTE: analyze() must be called prior to getCentroid(). Analyze()\ntells the FFT to analyze frequency data, and getCentroid() uses\nthe results determine the spectral centroid.</em></p></p>\n","itemtype":"method","name":"getCentroid","return":{"description":"Spectral Centroid Frequency Frequency of the spectral centroid in Hz.","type":"Number"},"example":["\n<div><code>\n\n\nfunction setup(){\ncnv = createCanvas(800,400);\nsound = new p5.AudioIn();\nsound.start();\nfft = new p5.FFT();\nsound.connect(fft);\n}\n\n\nfunction draw(){\n\nvar centroidplot = 0.0;\nvar spectralCentroid = 0;\n\n\nbackground(0);\nstroke(0,255,0);\nvar spectrum = fft.analyze(); \nfill(0,255,0); // spectrum is green\n\n//draw the spectrum\n\nfor (var i = 0; i< spectrum.length; i++){\n var x = map(log(i), 0, log(spectrum.length), 0, width);\n var h = map(spectrum[i], 0, 255, 0, height);\n var rectangle_width = (log(i+1)-log(i))*(width/log(spectrum.length));\n rect(x, height, rectangle_width, -h )\n}\n\nvar nyquist = 22050;\n\n// get the centroid\nspectralCentroid = fft.getCentroid();\n\n// the mean_freq_index calculation is for the display.\nvar mean_freq_index = spectralCentroid/(nyquist/spectrum.length);\n\ncentroidplot = map(log(mean_freq_index), 0, log(spectrum.length), 0, width);\n\n\nstroke(255,0,0); // the line showing where the centroid is will be red\n\nrect(centroidplot, 0, width / spectrum.length, height)\nnoStroke();\nfill(255,255,255); // text is white\ntextSize(40);\ntext(\"centroid: \"+round(spectralCentroid)+\" Hz\", 10, 40);\n}\n </code></div>"],"class":"p5.FFT","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":2869,"description":"<p>Smooth FFT analysis by averaging with the last analysis frame.</p>\n","itemtype":"method","name":"smooth","params":[{"name":"smoothing","description":"<p>0.0 &lt; smoothing &lt; 1.0.\n Defaults to 0.8.</p>\n","type":"Number"}],"class":"p5.FFT","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":2911,"class":"p5.FFT","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":3314,"class":"p5.FFT","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":3335,"class":"p5.FFT","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":3394,"class":"p5.FFT","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":3847,"class":"p5.FFT","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":3984,"class":"p5.FFT","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4017,"class":"p5.FFT","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4063,"class":"p5.FFT","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4084,"class":"p5.FFT","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4104,"class":"p5.FFT","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4206,"description":"<p>Fade to value, for smooth transitions</p>\n","itemtype":"method","name":"fade","params":[{"name":"value","description":"<p>Value to set this signal</p>\n","type":"Number"},{"name":"secondsFromNow","description":"<p>Length of fade, in seconds from now</p>\n","type":"[Number]"}],"class":"p5.Signal","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4217,"description":"<p>Connect a p5.sound object or Web Audio node to this\np5.Signal so that its amplitude values can be scaled.</p>\n","params":[{"name":"input","description":"","type":"Object"}],"class":"p5.Signal","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4230,"description":"<p>Add a constant value to this audio signal,\nand return the resulting audio signal. Does\nnot change the value of the original signal,\ninstead it returns a new p5.SignalAdd.</p>\n","itemtype":"method","name":"add","params":[{"name":"number","description":"","type":"Number"}],"return":{"description":"object","type":"p5.SignalAdd"},"class":"p5.Signal","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4249,"description":"<p>Multiply this signal by a constant value,\nand return the resulting audio signal. Does\nnot change the value of the original signal,\ninstead it returns a new p5.SignalMult.</p>\n","itemtype":"method","name":"mult","params":[{"name":"number","description":"<p>to multiply</p>\n","type":"Number"}],"return":{"description":"object","type":"Tone.Multiply"},"class":"p5.Signal","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4268,"description":"<p>Scale this signal value to a given range,\nand return the result as an audio signal. Does\nnot change the value of the original signal,\ninstead it returns a new p5.SignalScale.</p>\n","itemtype":"method","name":"scale","params":[{"name":"number","description":"<p>to multiply</p>\n","type":"Number"},{"name":"inMin","description":"<p>input range minumum</p>\n","type":"Number"},{"name":"inMax","description":"<p>input range maximum</p>\n","type":"Number"},{"name":"outMin","description":"<p>input range minumum</p>\n","type":"Number"},{"name":"outMax","description":"<p>input range maximum</p>\n","type":"Number"}],"return":{"description":"object","type":"p5.SignalScale"},"class":"p5.Signal","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4407,"description":"<p>Start an oscillator. Accepts an optional parameter to\ndetermine how long (in seconds from now) until the\noscillator starts.</p>\n","itemtype":"method","name":"start","params":[{"name":"time","description":"<p>startTime in seconds from now.</p>\n","type":"Number","optional":true},{"name":"frequency","description":"<p>frequency in Hz.</p>\n","type":"Number","optional":true}],"class":"p5.Oscillator","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4442,"description":"<p>Stop an oscillator. Accepts an optional parameter\nto determine how long (in seconds from now) until the\noscillator stops.</p>\n","itemtype":"method","name":"stop","params":[{"name":"secondsFromNow","description":"<p>Time, in seconds from now.</p>\n","type":"Number"}],"class":"p5.Oscillator","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4458,"description":"<p>Set the amplitude between 0 and 1.0. Or, pass in an object\nsuch as an oscillator to modulate amplitude with an audio signal.</p>\n","itemtype":"method","name":"amp","params":[{"name":"vol","description":"<p>between 0 and 1.0\n or a modulating signal/oscillator</p>\n","type":"Number|Object"},{"name":"rampTime","description":"<p>create a fade that lasts rampTime</p>\n","type":"Number","optional":true},{"name":"timeFromNow","description":"<p>schedule this event to happen\n seconds from now</p>\n","type":"Number","optional":true}],"return":{"description":"gain If no value is provided,\n returns the Web Audio API\n AudioParam that controls\n this oscillator's\n gain/amplitude/volume)","type":"AudioParam"},"class":"p5.Oscillator","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4496,"description":"<p>Set frequency of an oscillator to a value. Or, pass in an object\nsuch as an oscillator to modulate the frequency with an audio signal.</p>\n","itemtype":"method","name":"freq","params":[{"name":"Frequency","description":"<p>Frequency in Hz\n or modulating signal/oscillator</p>\n","type":"Number|Object"},{"name":"rampTime","description":"<p>Ramp time (in seconds)</p>\n","type":"Number","optional":true},{"name":"timeFromNow","description":"<p>Schedule this event to happen\n at x seconds from now</p>\n","type":"Number","optional":true}],"return":{"description":"Frequency If no value is provided,\n returns the Web Audio API\n AudioParam that controls\n this oscillator's frequency","type":"AudioParam"},"example":["\n<div><code>\nvar osc = new p5.Oscillator(300);\nosc.start();\nosc.freq(40, 10);\n</code></div>"],"class":"p5.Oscillator","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4555,"description":"<p>Set type to &#39;sine&#39;, &#39;triangle&#39;, &#39;sawtooth&#39; or &#39;square&#39;.</p>\n","itemtype":"method","name":"setType","params":[{"name":"type","description":"<p>&#39;sine&#39;, &#39;triangle&#39;, &#39;sawtooth&#39; or &#39;square&#39;.</p>\n","type":"String"}],"class":"p5.Oscillator","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4567,"description":"<p>Connect to a p5.sound / Web Audio object.</p>\n","itemtype":"method","name":"connect","params":[{"name":"unit","description":"<p>A p5.sound or Web Audio object</p>\n","type":"Object"}],"class":"p5.Oscillator","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4584,"description":"<p>Disconnect all outputs</p>\n","itemtype":"method","name":"disconnect","class":"p5.Oscillator","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4595,"description":"<p>Pan between Left (-1) and Right (1)</p>\n","itemtype":"method","name":"pan","params":[{"name":"panning","description":"<p>Number between -1 and 1</p>\n","type":"Number"},{"name":"timeFromNow","description":"<p>schedule this event to happen\n seconds from now</p>\n","type":"Number"}],"class":"p5.Oscillator","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4628,"description":"<p>Set the phase of an oscillator between 0.0 and 1.0.\nIn this implementation, phase is a delay time\nbased on the oscillator&#39;s current frequency.</p>\n","itemtype":"method","name":"phase","params":[{"name":"phase","description":"<p>float between 0.0 and 1.0</p>\n","type":"Number"}],"class":"p5.Oscillator","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4682,"description":"<p>Add a value to the p5.Oscillator&#39;s output amplitude,\nand return the oscillator. Calling this method again\nwill override the initial add() with a new value.</p>\n","itemtype":"method","name":"add","params":[{"name":"number","description":"<p>Constant number to add</p>\n","type":"Number"}],"return":{"description":"Oscillator Returns this oscillator\n with scaled output","type":"p5.Oscillator"},"class":"p5.Oscillator","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4699,"description":"<p>Multiply the p5.Oscillator&#39;s output amplitude\nby a fixed value (i.e. turn it up!). Calling this method\nagain will override the initial mult() with a new value.</p>\n","itemtype":"method","name":"mult","params":[{"name":"number","description":"<p>Constant number to multiply</p>\n","type":"Number"}],"return":{"description":"Oscillator Returns this oscillator\n with multiplied output","type":"p5.Oscillator"},"class":"p5.Oscillator","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4715,"description":"<p>Scale this oscillator&#39;s amplitude values to a given\nrange, and return the oscillator. Calling this method\nagain will override the initial scale() with new values.</p>\n","itemtype":"method","name":"scale","params":[{"name":"inMin","description":"<p>input range minumum</p>\n","type":"Number"},{"name":"inMax","description":"<p>input range maximum</p>\n","type":"Number"},{"name":"outMin","description":"<p>input range minumum</p>\n","type":"Number"},{"name":"outMax","description":"<p>input range maximum</p>\n","type":"Number"}],"return":{"description":"Oscillator Returns this oscillator\n with scaled output","type":"p5.Oscillator"},"class":"p5.Oscillator","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4745,"description":"<p>Constructor: <code>new p5.SinOsc()</code>.\nThis creates a Sine Wave Oscillator and is\nequivalent to <code> new p5.Oscillator(&#39;sine&#39;)\n</code> or creating a p5.Oscillator and then calling\nits method <code>setType(&#39;sine&#39;)</code>.\nSee p5.Oscillator for methods.</p>\n","itemtype":"method","name":"p5.SinOsc","params":[{"name":"freq","description":"<p>Set the frequency</p>\n","type":"[Number]"}],"class":"p5.Oscillator","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4760,"description":"<p>Constructor: <code>new p5.TriOsc()</code>.\nThis creates a Triangle Wave Oscillator and is\nequivalent to <code>new p5.Oscillator(&#39;triangle&#39;)\n</code> or creating a p5.Oscillator and then calling\nits method <code>setType(&#39;triangle&#39;)</code>.\nSee p5.Oscillator for methods.</p>\n","itemtype":"method","name":"p5.TriOsc","params":[{"name":"freq","description":"<p>Set the frequency</p>\n","type":"[Number]"}],"class":"p5.Oscillator","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4775,"description":"<p>Constructor: <code>new p5.SawOsc()</code>.\nThis creates a SawTooth Wave Oscillator and is\nequivalent to <code> new p5.Oscillator(&#39;sawtooth&#39;)\n</code> or creating a p5.Oscillator and then calling\nits method <code>setType(&#39;sawtooth&#39;)</code>.\nSee p5.Oscillator for methods.</p>\n","itemtype":"method","name":"p5.SawOsc","params":[{"name":"freq","description":"<p>Set the frequency</p>\n","type":"[Number]"}],"class":"p5.Oscillator","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4790,"description":"<p>Constructor: <code>new p5.SqrOsc()</code>.\nThis creates a Square Wave Oscillator and is\nequivalent to <code> new p5.Oscillator(&#39;square&#39;)\n</code> or creating a p5.Oscillator and then calling\nits method <code>setType(&#39;square&#39;)</code>.\nSee p5.Oscillator for methods.</p>\n","itemtype":"method","name":"p5.SqrOsc","params":[{"name":"freq","description":"<p>Set the frequency</p>\n","type":"[Number]"}],"class":"p5.Oscillator","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4806,"class":"p5.Oscillator","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":4992,"class":"p5.Oscillator","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":5217,"description":"<p>Time until envelope reaches attackLevel</p>\n","itemtype":"property","name":"attackTime","class":"p5.Env","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":5222,"description":"<p>Level once attack is complete.</p>\n","itemtype":"property","name":"attackLevel","class":"p5.Env","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":5227,"description":"<p>Time until envelope reaches decayLevel.</p>\n","itemtype":"property","name":"decayTime","class":"p5.Env","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":5232,"description":"<p>Level after decay. The envelope will sustain here until it is released.</p>\n","itemtype":"property","name":"decayLevel","class":"p5.Env","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":5237,"description":"<p>Duration of the release portion of the envelope.</p>\n","itemtype":"property","name":"releaseTime","class":"p5.Env","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":5242,"description":"<p>Level at the end of the release.</p>\n","itemtype":"property","name":"releaseLevel","class":"p5.Env","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":5278,"description":"<p>Reset the envelope with a series of time/value pairs.</p>\n","itemtype":"method","name":"set","params":[{"name":"attackTime","description":"<p>Time (in seconds) before level\n reaches attackLevel</p>\n","type":"Number"},{"name":"attackLevel","description":"<p>Typically an amplitude between\n 0.0 and 1.0</p>\n","type":"Number"},{"name":"decayTime","description":"<p>Time</p>\n","type":"Number"},{"name":"decayLevel","description":"<p>Amplitude (In a standard ADSR envelope,\n decayLevel = sustainLevel)</p>\n","type":"Number"},{"name":"releaseTime","description":"<p>Release Time (in seconds)</p>\n","type":"Number"},{"name":"releaseLevel","description":"<p>Amplitude</p>\n","type":"Number"}],"class":"p5.Env","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":5302,"description":"<p>Set values like a traditional\n<a href=\"https://en.wikipedia.org/wiki/Synthesizer#/media/File:ADSR_parameter.svg\">\nADSR envelope\n</a>.</p>\n","itemtype":"method","name":"setADSR","params":[{"name":"attackTime","description":"<p>Time (in seconds before envelope\n reaches Attack Level</p>\n","type":"Number"},{"name":"decayTime","description":"<p>Time (in seconds) before envelope\n reaches Decay/Sustain Level</p>\n","type":"Number","optional":true},{"name":"susRatio","description":"<p>Ratio between attackLevel and releaseLevel, on a scale from 0 to 1,\n where 1.0 = attackLevel, 0.0 = releaseLevel.\n The susRatio determines the decayLevel and the level at which the\n sustain portion of the envelope will sustain.\n For example, if attackLevel is 0.4, releaseLevel is 0,\n and susAmt is 0.5, the decayLevel would be 0.2. If attackLevel is\n increased to 1.0 (using <code>setRange</code>),\n then decayLevel would increase proportionally, to become 0.5.</p>\n","type":"Number","optional":true},{"name":"releaseTime","description":"<p>Time in seconds from now (defaults to 0)</p>\n","type":"Number","optional":true}],"example":["\n<div><code>\nvar attackLevel = 1.0;\nvar releaseLevel = 0;\n\nvar attackTime = 0.001\nvar decayTime = 0.2;\nvar susPercent = 0.2;\nvar releaseTime = 0.5;\n\nvar env, triOsc;\n\nfunction setup() {\n var cnv = createCanvas(100, 100);\n\n textAlign(CENTER);\n text('click to play', width/2, height/2);\n\n env = new p5.Env();\n env.setADSR(attackTime, decayTime, susPercent, releaseTime);\n env.setRange(attackLevel, releaseLevel);\n\n triOsc = new p5.Oscillator('triangle');\n triOsc.amp(env);\n triOsc.start();\n triOsc.freq(220);\n\n cnv.mousePressed(playEnv);\n}\n\nfunction playEnv(){\n env.play();\n}\n</code></div>"],"class":"p5.Env","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":5367,"description":"<p>Set max (attackLevel) and min (releaseLevel) of envelope.</p>\n","itemtype":"method","name":"setRange","params":[{"name":"aLevel","description":"<p>attack level (defaults to 1)</p>\n","type":"Number"},{"name":"rLevel","description":"<p>release level (defaults to 0)</p>\n","type":"Number"}],"example":["\n<div><code>\nvar attackLevel = 1.0;\nvar releaseLevel = 0;\n\nvar attackTime = 0.001\nvar decayTime = 0.2;\nvar susPercent = 0.2;\nvar releaseTime = 0.5;\n\nvar env, triOsc;\n\nfunction setup() {\n var cnv = createCanvas(100, 100);\n\n textAlign(CENTER);\n text('click to play', width/2, height/2);\n\n env = new p5.Env();\n env.setADSR(attackTime, decayTime, susPercent, releaseTime);\n env.setRange(attackLevel, releaseLevel);\n\n triOsc = new p5.Oscillator('triangle');\n triOsc.amp(env);\n triOsc.start();\n triOsc.freq(220);\n\n cnv.mousePressed(playEnv);\n}\n\nfunction playEnv(){\n env.play();\n}\n</code></div>"],"class":"p5.Env","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":5446,"description":"<p>Assign a parameter to be controlled by this envelope.\nIf a p5.Sound object is given, then the p5.Env will control its\noutput gain. If multiple inputs are provided, the env will\ncontrol all of them.</p>\n","itemtype":"method","name":"setInput","params":[{"name":"unit","description":"<p>A p5.sound object or\n Web Audio Param.</p>\n","type":"Object"}],"class":"p5.Env","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":5461,"description":"<p>Set whether the envelope ramp is linear (default) or exponential.\nExponential ramps can be useful because we perceive amplitude\nand frequency logarithmically.</p>\n","itemtype":"method","name":"setExp","params":[{"name":"isExp","description":"<p>true is exponential, false is linear</p>\n","type":"Boolean"}],"class":"p5.Env","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":5479,"description":"<p>Play tells the envelope to start acting on a given input.\nIf the input is a p5.sound object (i.e. AudioIn, Oscillator,\nSoundFile), then Env will control its output volume.\nEnvelopes can also be used to control any <a href=\"\nhttp://docs.webplatform.org/wiki/apis/webaudio/AudioParam\">\nWeb Audio Audio Param.</a></p>\n","itemtype":"method","name":"play","params":[{"name":"unit","description":"<p>A p5.sound object or\n Web Audio Param.</p>\n","type":"Object"},{"name":"startTime","description":"<p>time from now (in seconds) at which to play</p>\n","type":"Number","optional":true},{"name":"sustainTime","description":"<p>time to sustain before releasing the envelope</p>\n","type":"Number","optional":true}],"example":["\n<div><code>\nvar attackLevel = 1.0;\nvar releaseLevel = 0;\n\nvar attackTime = 0.001\nvar decayTime = 0.2;\nvar susPercent = 0.2;\nvar releaseTime = 0.5;\n\nvar env, triOsc;\n\nfunction setup() {\n var cnv = createCanvas(100, 100);\n\n textAlign(CENTER);\n text('click to play', width/2, height/2);\n\n env = new p5.Env();\n env.setADSR(attackTime, decayTime, susPercent, releaseTime);\n env.setRange(attackLevel, releaseLevel);\n\n triOsc = new p5.Oscillator('triangle');\n triOsc.amp(env);\n triOsc.start();\n triOsc.freq(220);\n\n cnv.mousePressed(playEnv);\n}\n\nfunction playEnv(){\n // trigger env on triOsc, 0 seconds from now\n // After decay, sustain for 0.2 seconds before release\n env.play(triOsc, 0, 0.2);\n}\n</code></div>"],"class":"p5.Env","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":5541,"description":"<p>Trigger the Attack, and Decay portion of the Envelope.\nSimilar to holding down a key on a piano, but it will\nhold the sustain level until you let go. Input can be\nany p5.sound object, or a <a href=\"\nhttp://docs.webplatform.org/wiki/apis/webaudio/AudioParam\">\nWeb Audio Param</a>.</p>\n","itemtype":"method","name":"triggerAttack","params":[{"name":"unit","description":"<p>p5.sound Object or Web Audio Param</p>\n","type":"Object"},{"name":"secondsFromNow","description":"<p>time from now (in seconds)</p>\n","type":"Number"}],"example":["\n<div><code>\n\nvar attackLevel = 1.0;\nvar releaseLevel = 0;\n\nvar attackTime = 0.001\nvar decayTime = 0.3;\nvar susPercent = 0.4;\nvar releaseTime = 0.5;\n\nvar env, triOsc;\n\nfunction setup() {\n var cnv = createCanvas(100, 100);\n background(200);\n textAlign(CENTER);\n text('click to play', width/2, height/2);\n\n env = new p5.Env();\n env.setADSR(attackTime, decayTime, susPercent, releaseTime);\n env.setRange(attackLevel, releaseLevel);\n\n triOsc = new p5.Oscillator('triangle');\n triOsc.amp(env);\n triOsc.start();\n triOsc.freq(220);\n\n cnv.mousePressed(envAttack);\n}\n\nfunction envAttack(){\n console.log('trigger attack');\n env.triggerAttack();\n\n background(0,255,0);\n text('attack!', width/2, height/2);\n}\n\nfunction mouseReleased() {\n env.triggerRelease();\n\n background(200);\n text('click to play', width/2, height/2);\n}\n</code></div>"],"class":"p5.Env","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":5650,"description":"<p>Trigger the Release of the Envelope. This is similar to releasing\nthe key on a piano and letting the sound fade according to the\nrelease level and release time.</p>\n","itemtype":"method","name":"triggerRelease","params":[{"name":"unit","description":"<p>p5.sound Object or Web Audio Param</p>\n","type":"Object"},{"name":"secondsFromNow","description":"<p>time to trigger the release</p>\n","type":"Number"}],"example":["\n<div><code>\n\nvar attackLevel = 1.0;\nvar releaseLevel = 0;\n\nvar attackTime = 0.001\nvar decayTime = 0.3;\nvar susPercent = 0.4;\nvar releaseTime = 0.5;\n\nvar env, triOsc;\n\nfunction setup() {\n var cnv = createCanvas(100, 100);\n background(200);\n textAlign(CENTER);\n text('click to play', width/2, height/2);\n\n env = new p5.Env();\n env.setADSR(attackTime, decayTime, susPercent, releaseTime);\n env.setRange(attackLevel, releaseLevel);\n\n triOsc = new p5.Oscillator('triangle');\n triOsc.amp(env);\n triOsc.start();\n triOsc.freq(220);\n\n cnv.mousePressed(envAttack);\n}\n\nfunction envAttack(){\n console.log('trigger attack');\n env.triggerAttack();\n\n background(0,255,0);\n text('attack!', width/2, height/2);\n}\n\nfunction mouseReleased() {\n env.triggerRelease();\n\n background(200);\n text('click to play', width/2, height/2);\n}\n</code></div>"],"class":"p5.Env","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":5749,"description":"<p>Exponentially ramp to a value using the first two\nvalues from <code><a href=\"#/p5.Env/setADSR\">setADSR(attackTime, decayTime)</a></code>\nas <a href=\"https://en.wikipedia.org/wiki/RC_time_constant\">\ntime constants</a> for simple exponential ramps.\nIf the value is higher than current value, it uses attackTime,\nwhile a decrease uses decayTime.</p>\n","itemtype":"method","name":"ramp","params":[{"name":"unit","description":"<p>p5.sound Object or Web Audio Param</p>\n","type":"Object"},{"name":"secondsFromNow","description":"<p>When to trigger the ramp</p>\n","type":"Number"},{"name":"v","description":"<p>Target value</p>\n","type":"Number"},{"name":"v2","description":"<p>Second target value (optional)</p>\n","type":"Number","optional":true}],"example":["\n<div><code>\nvar env, osc, amp, cnv;\n\nvar attackTime = 0.001;\nvar decayTime = 0.2;\nvar attackLevel = 1;\nvar decayLevel = 0;\n\nfunction setup() {\n cnv = createCanvas(100, 100);\n fill(0,255,0);\n noStroke();\n\n env = new p5.Env();\n env.setADSR(attackTime, decayTime);\n\n osc = new p5.Oscillator();\n osc.amp(env);\n osc.start();\n\n amp = new p5.Amplitude();\n\n cnv.mousePressed(triggerRamp);\n}\n\nfunction triggerRamp() {\n env.ramp(osc, 0, attackLevel, decayLevel);\n}\n\nfunction draw() {\n background(20,20,20);\n text('click me', 10, 20);\n var h = map(amp.getLevel(), 0, 0.4, 0, height);;\n\n rect(0, height, width, -h);\n}\n</code></div>"],"class":"p5.Env","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":5854,"description":"<p>Add a value to the p5.Oscillator&#39;s output amplitude,\nand return the oscillator. Calling this method\nagain will override the initial add() with new values.</p>\n","itemtype":"method","name":"add","params":[{"name":"number","description":"<p>Constant number to add</p>\n","type":"Number"}],"return":{"description":"Envelope Returns this envelope\n with scaled output","type":"p5.Env"},"class":"p5.Env","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":5870,"description":"<p>Multiply the p5.Env&#39;s output amplitude\nby a fixed value. Calling this method\nagain will override the initial mult() with new values.</p>\n","itemtype":"method","name":"mult","params":[{"name":"number","description":"<p>Constant number to multiply</p>\n","type":"Number"}],"return":{"description":"Envelope Returns this envelope\n with scaled output","type":"p5.Env"},"class":"p5.Env","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":5886,"description":"<p>Scale this envelope&#39;s amplitude values to a given\nrange, and return the envelope. Calling this method\nagain will override the initial scale() with new values.</p>\n","itemtype":"method","name":"scale","params":[{"name":"inMin","description":"<p>input range minumum</p>\n","type":"Number"},{"name":"inMax","description":"<p>input range maximum</p>\n","type":"Number"},{"name":"outMin","description":"<p>input range minumum</p>\n","type":"Number"},{"name":"outMax","description":"<p>input range maximum</p>\n","type":"Number"}],"return":{"description":"Envelope Returns this envelope\n with scaled output","type":"p5.Env"},"class":"p5.Env","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":5989,"description":"<p>Set the width of a Pulse object (an oscillator that implements\nPulse Width Modulation).</p>\n","itemtype":"method","name":"width","params":[{"name":"width","description":"<p>Width between the pulses (0 to 1.0,\n defaults to 0)</p>\n","type":"Number","optional":true}],"class":"p5.Pulse","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6166,"description":"<p>Set type of noise to &#39;white&#39;, &#39;pink&#39; or &#39;brown&#39;.\nWhite is the default.</p>\n","itemtype":"method","name":"setType","params":[{"name":"type","description":"<p>&#39;white&#39;, &#39;pink&#39; or &#39;brown&#39;</p>\n","type":"String","optional":true}],"class":"p5.Noise","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6196,"description":"<p>Start the noise</p>\n","itemtype":"method","name":"start","class":"p5.Noise","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6213,"description":"<p>Stop the noise.</p>\n","itemtype":"method","name":"stop","class":"p5.Noise","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6225,"description":"<p>Pan the noise.</p>\n","itemtype":"method","name":"pan","params":[{"name":"panning","description":"<p>Number between -1 (left)\n and 1 (right)</p>\n","type":"Number"},{"name":"timeFromNow","description":"<p>schedule this event to happen\n seconds from now</p>\n","type":"Number"}],"class":"p5.Noise","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6234,"description":"<p>Set the amplitude of the noise between 0 and 1.0. Or,\nmodulate amplitude with an audio signal such as an oscillator.</p>\n","params":[{"name":"volume","description":"<p>amplitude between 0 and 1.0\n or modulating signal/oscillator</p>\n","type":"Number|Object"},{"name":"rampTime","description":"<p>create a fade that lasts rampTime</p>\n","type":"Number","optional":true},{"name":"timeFromNow","description":"<p>schedule this event to happen\n seconds from now</p>\n","type":"Number","optional":true}],"class":"p5.Noise","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6244,"description":"<p>Send output to a p5.sound or web audio object</p>\n","itemtype":"method","name":"connect","params":[{"name":"unit","description":"","type":"Object"}],"class":"p5.Noise","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6250,"description":"<p>Disconnect all output.</p>\n","itemtype":"method","name":"disconnect","class":"p5.Noise","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6319,"description":"<p>Client must allow browser to access their microphone / audioin source.\nDefault: false. Will become true when the client enables acces.</p>\n","itemtype":"property","name":"enabled","type":"Boolean","class":"p5.AudioIn","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6340,"description":"<p>Start processing audio input. This enables the use of other\nAudioIn methods like getLevel(). Note that by default, AudioIn\nis not connected to p5.sound&#39;s output. So you won&#39;t hear\nanything unless you use the connect() method.<br/></p>\n","itemtype":"method","name":"start","params":[{"name":"successCallback","description":"<p>Name of a function to call on\n success.</p>\n","type":"Function"},{"name":"errorCallback","description":"<p>Name of a function to call if\n there was an error. For example,\n some browsers do not support\n getUserMedia.</p>\n","type":"Function"}],"class":"p5.AudioIn","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6399,"description":"<p>Turn the AudioIn off. If the AudioIn is stopped, it cannot getLevel().<br/></p>\n","itemtype":"method","name":"stop","class":"p5.AudioIn","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6409,"description":"<p>Connect to an audio unit. If no parameter is provided, will\nconnect to the master output (i.e. your speakers).<br/></p>\n","itemtype":"method","name":"connect","params":[{"name":"unit","description":"<p>An object that accepts audio input,\n such as an FFT</p>\n","type":"Object","optional":true}],"class":"p5.AudioIn","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6430,"description":"<p>Disconnect the AudioIn from all audio units. For example, if\nconnect() had been called, disconnect() will stop sending \nsignal to your speakers.<br/></p>\n","itemtype":"method","name":"disconnect","class":"p5.AudioIn","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6442,"description":"<p>Read the Amplitude (volume level) of an AudioIn. The AudioIn\nclass contains its own instance of the Amplitude class to help\nmake it easy to get a microphone&#39;s volume level. Accepts an\noptional smoothing value (0.0 &lt; 1.0). <em>NOTE: AudioIn must\n.start() before using .getLevel().</em><br/></p>\n","itemtype":"method","name":"getLevel","params":[{"name":"smoothing","description":"<p>Smoothing is 0.0 by default.\n Smooths values based on previous values.</p>\n","type":"Number","optional":true}],"return":{"description":"Volume level (between 0.0 and 1.0)","type":"Number"},"class":"p5.AudioIn","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6460,"description":"<p>Add input sources to the list of available sources.</p>\n","access":"private","tagname":"","class":"p5.AudioIn","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6475,"description":"<p>Set amplitude (volume) of a mic input between 0 and 1.0. <br/></p>\n","itemtype":"method","name":"amp","params":[{"name":"vol","description":"<p>between 0 and 1.0</p>\n","type":"Number"},{"name":"time","description":"<p>ramp time (optional)</p>\n","type":"Number","optional":true}],"class":"p5.AudioIn","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6503,"description":"<p>Chrome only. Returns a list of available input sources \nand allows the user to set the media source. Firefox allows \nthe user to choose from input sources in the permissions dialogue\ninstead of enumerating available sources and selecting one.\nNote: in order to have descriptive media names your page must be \nserved over a secure (HTTPS) connection and the page should \nrequest user media before enumerating devices. Otherwise device \nID will be a long device ID number and does not specify device \ntype. For example see \n<a href=\"https://simpl.info/getusermedia/sources/index.html\">https://simpl.info/getusermedia/sources/index.html</a> vs.\n<a href=\"http://simpl.info/getusermedia/sources/index.html\">http://simpl.info/getusermedia/sources/index.html</a></p>\n","itemtype":"method","name":"getSources","params":[{"name":"callback","description":"<p>a callback to handle the sources \n when they have been enumerated</p>\n","type":"Function"}],"example":["\n <div><code>\n var audiograb;\n \n function setup(){\n //new audioIn\n audioGrab = new p5.AudioIn();\n \n audioGrab.getSources(function(sourceList) {\n //print out the array of available sources\n console.log(sourceList);\n //set the source to the first item in the inputSources array\n audioGrab.setSource(0);\n });\n }\n </code></div>"],"class":"p5.AudioIn","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6552,"description":"<p>Set the input source. Accepts a number representing a\nposition in the array returned by listSources().\nThis is only available in browsers that support \nMediaStreamTrack.getSources(). Instead, some browsers\ngive users the option to set their own media source.<br/></p>\n","itemtype":"method","name":"setSource","params":[{"name":"num","description":"<p>position of input source in the array</p>\n","type":"Number"}],"class":"p5.AudioIn","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6667,"description":"<p>The p5.Filter is built with a\n<a href=\"http://www.w3.org/TR/webaudio/#BiquadFilterNode\">\nWeb Audio BiquadFilter Node</a>.</p>\n","itemtype":"property","name":"biquadFilter","type":"{Object} Web Audio Delay Node","class":"p5.Filter","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6685,"description":"<p>Filter an audio signal according to a set\nof filter parameters.</p>\n","itemtype":"method","name":"process","params":[{"name":"Signal","description":"<p>An object that outputs audio</p>\n","type":"Object"},{"name":"freq","description":"<p>Frequency in Hz, from 10 to 22050</p>\n","type":"[Number]"},{"name":"res","description":"<p>Resonance/Width of the filter frequency\n from 0.001 to 1000</p>\n","type":"[Number]"}],"class":"p5.Filter","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6699,"description":"<p>Set the frequency and the resonance of the filter.</p>\n","itemtype":"method","name":"set","params":[{"name":"freq","description":"<p>Frequency in Hz, from 10 to 22050</p>\n","type":"Number"},{"name":"res","description":"<p>Resonance (Q) from 0.001 to 1000</p>\n","type":"Number"},{"name":"timeFromNow","description":"<p>schedule this event to happen\n seconds from now</p>\n","type":"Number","optional":true}],"class":"p5.Filter","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6716,"description":"<p>Set the filter frequency, in Hz, from 10 to 22050 (the range of\nhuman hearing, although in reality most people hear in a narrower\nrange).</p>\n","itemtype":"method","name":"freq","params":[{"name":"freq","description":"<p>Filter Frequency</p>\n","type":"Number"},{"name":"timeFromNow","description":"<p>schedule this event to happen\n seconds from now</p>\n","type":"Number","optional":true}],"return":{"description":"value Returns the current frequency value","type":"Number"},"class":"p5.Filter","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6742,"description":"<p>Controls either width of a bandpass frequency,\nor the resonance of a low/highpass cutoff frequency.</p>\n","itemtype":"method","name":"res","params":[{"name":"res","description":"<p>Resonance/Width of filter freq\n from 0.001 to 1000</p>\n","type":"Number"},{"name":"timeFromNow","description":"<p>schedule this event to happen\n seconds from now</p>\n","type":"Number","optional":true}],"return":{"description":"value Returns the current res value","type":"Number"},"class":"p5.Filter","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6765,"description":"<p>Set the type of a p5.Filter. Possible types include: \n&quot;lowpass&quot; (default), &quot;highpass&quot;, &quot;bandpass&quot;, \n&quot;lowshelf&quot;, &quot;highshelf&quot;, &quot;peaking&quot;, &quot;notch&quot;,\n&quot;allpass&quot;.</p>\n","itemtype":"method","name":"setType","params":[{"name":"UNKNOWN","description":"","type":"String"}],"class":"p5.Filter","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6777,"description":"<p>Set the output level of the filter.</p>\n","itemtype":"method","name":"amp","params":[{"name":"volume","description":"<p>amplitude between 0 and 1.0</p>\n","type":"Number"},{"name":"rampTime","description":"<p>create a fade that lasts rampTime</p>\n","type":"Number","optional":true},{"name":"timeFromNow","description":"<p>schedule this event to happen\n seconds from now</p>\n","type":"Number","optional":true}],"class":"p5.Filter","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6795,"description":"<p>Send output to a p5.sound or web audio object</p>\n","itemtype":"method","name":"connect","params":[{"name":"unit","description":"","type":"Object"}],"class":"p5.Filter","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6805,"description":"<p>Disconnect all output.</p>\n","itemtype":"method","name":"disconnect","class":"p5.Filter","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6824,"description":"<p>Constructor: <code>new p5.LowPass()</code> Filter.\nThis is the same as creating a p5.Filter and then calling\nits method <code>setType(&#39;lowpass&#39;)</code>.\nSee p5.Filter for methods.</p>\n","itemtype":"method","name":"p5.LowPass","class":"p5.Filter","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6836,"description":"<p>Constructor: <code>new p5.HighPass()</code> Filter.\nThis is the same as creating a p5.Filter and then calling\nits method <code>setType(&#39;highpass&#39;)</code>.\nSee p5.Filter for methods.</p>\n","itemtype":"method","name":"p5.HighPass","class":"p5.Filter","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6848,"description":"<p>Constructor: <code>new p5.BandPass()</code> Filter.\nThis is the same as creating a p5.Filter and then calling\nits method <code>setType(&#39;bandpass&#39;)</code>.\nSee p5.Filter for methods.</p>\n","itemtype":"method","name":"p5.BandPass","class":"p5.Filter","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6922,"description":"<p>The p5.Delay is built with two\n<a href=\"http://www.w3.org/TR/webaudio/#DelayNode\">\nWeb Audio Delay Nodes</a>, one for each stereo channel.</p>\n","itemtype":"property","name":"leftDelay","type":"{Object} Web Audio Delay Node","class":"p5.Delay","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6931,"description":"<p>The p5.Delay is built with two\n<a href=\"http://www.w3.org/TR/webaudio/#DelayNode\">\nWeb Audio Delay Nodes</a>, one for each stereo channel.</p>\n","itemtype":"property","name":"rightDelay","type":"{Object} Web Audio Delay Node","class":"p5.Delay","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6964,"description":"<p>Add delay to an audio signal according to a set\nof delay parameters.</p>\n","itemtype":"method","name":"process","params":[{"name":"Signal","description":"<p>An object that outputs audio</p>\n","type":"Object"},{"name":"delayTime","description":"<p>Time (in seconds) of the delay/echo.\n Some browsers limit delayTime to\n 1 second.</p>\n","type":"Number","optional":true},{"name":"feedback","description":"<p>sends the delay back through itself\n in a loop that decreases in volume\n each time.</p>\n","type":"Number","optional":true},{"name":"lowPass","description":"<p>Cutoff frequency. Only frequencies\n below the lowPass will be part of the\n delay.</p>\n","type":"Number","optional":true}],"class":"p5.Delay","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":6999,"description":"<p>Set the delay (echo) time, in seconds. Usually this value will be\na floating point number between 0.0 and 1.0.</p>\n","itemtype":"method","name":"delayTime","params":[{"name":"delayTime","description":"<p>Time (in seconds) of the delay</p>\n","type":"Number"}],"class":"p5.Delay","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7018,"description":"<p>Feedback occurs when Delay sends its signal back through its input\nin a loop. The feedback amount determines how much signal to send each\ntime through the loop. A feedback greater than 1.0 is not desirable because\nit will increase the overall output each time through the loop,\ncreating an infinite feedback loop.</p>\n","itemtype":"method","name":"feedback","params":[{"name":"feedback","description":"<p>0.0 to 1.0, or an object such as an\n Oscillator that can be used to\n modulate this param</p>\n","type":"Number|Object"}],"class":"p5.Delay","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7042,"description":"<p>Set a lowpass filter frequency for the delay. A lowpass filter\nwill cut off any frequencies higher than the filter frequency.</p>\n","itemtype":"method","name":"filter","params":[{"name":"cutoffFreq","description":"<p>A lowpass filter will cut off any \n frequencies higher than the filter frequency.</p>\n","type":"Number|Object"},{"name":"res","description":"<p>Resonance of the filter frequency\n cutoff, or an object (i.e. a p5.Oscillator)\n that can be used to modulate this parameter.\n High numbers (i.e. 15) will produce a resonance,\n low numbers (i.e. .2) will produce a slope.</p>\n","type":"Number|Object"}],"class":"p5.Delay","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7059,"description":"<p>Choose a preset type of delay. &#39;pingPong&#39; bounces the signal\nfrom the left to the right channel to produce a stereo effect.\nAny other parameter will revert to the default delay setting.</p>\n","itemtype":"method","name":"setType","params":[{"name":"type","description":"<p>&#39;pingPong&#39; (1) or &#39;default&#39; (0)</p>\n","type":"String|Number"}],"class":"p5.Delay","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7091,"description":"<p>Set the output level of the delay effect.</p>\n","itemtype":"method","name":"amp","params":[{"name":"volume","description":"<p>amplitude between 0 and 1.0</p>\n","type":"Number"},{"name":"rampTime","description":"<p>create a fade that lasts rampTime</p>\n","type":"Number","optional":true},{"name":"timeFromNow","description":"<p>schedule this event to happen\n seconds from now</p>\n","type":"Number","optional":true}],"class":"p5.Delay","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7109,"description":"<p>Send output to a p5.sound or web audio object</p>\n","itemtype":"method","name":"connect","params":[{"name":"unit","description":"","type":"Object"}],"class":"p5.Delay","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7119,"description":"<p>Disconnect all output.</p>\n","itemtype":"method","name":"disconnect","class":"p5.Delay","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7204,"description":"<p>Connect a source to the reverb, and assign reverb parameters.</p>\n","itemtype":"method","name":"process","params":[{"name":"src","description":"<p>p5.sound / Web Audio object with a sound\n output.</p>\n","type":"Object"},{"name":"seconds","description":"<p>Duration of the reverb, in seconds.\n Min: 0, Max: 10. Defaults to 3.</p>\n","type":"Number","optional":true},{"name":"decayRate","description":"<p>Percentage of decay with each echo.\n Min: 0, Max: 100. Defaults to 2.</p>\n","type":"Number","optional":true},{"name":"reverse","description":"<p>Play the reverb backwards or forwards.</p>\n","type":"Boolean","optional":true}],"class":"p5.Reverb","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7233,"description":"<p>Set the reverb settings. Similar to .process(), but without\nassigning a new input.</p>\n","itemtype":"method","name":"set","params":[{"name":"seconds","description":"<p>Duration of the reverb, in seconds.\n Min: 0, Max: 10. Defaults to 3.</p>\n","type":"Number","optional":true},{"name":"decayRate","description":"<p>Percentage of decay with each echo.\n Min: 0, Max: 100. Defaults to 2.</p>\n","type":"Number","optional":true},{"name":"reverse","description":"<p>Play the reverb backwards or forwards.</p>\n","type":"Boolean","optional":true}],"class":"p5.Reverb","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7260,"description":"<p>Set the output level of the delay effect.</p>\n","itemtype":"method","name":"amp","params":[{"name":"volume","description":"<p>amplitude between 0 and 1.0</p>\n","type":"Number"},{"name":"rampTime","description":"<p>create a fade that lasts rampTime</p>\n","type":"Number","optional":true},{"name":"timeFromNow","description":"<p>schedule this event to happen\n seconds from now</p>\n","type":"Number","optional":true}],"class":"p5.Reverb","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7278,"description":"<p>Send output to a p5.sound or web audio object</p>\n","itemtype":"method","name":"connect","params":[{"name":"unit","description":"","type":"Object"}],"class":"p5.Reverb","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7288,"description":"<p>Disconnect all output.</p>\n","itemtype":"method","name":"disconnect","class":"p5.Reverb","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7296,"description":"<p>Inspired by Simple Reverb by Jordan Santell\n<a href=\"https://github.com/web-audio-components/simple-reverb/blob/master/index.js\">https://github.com/web-audio-components/simple-reverb/blob/master/index.js</a></p>\n<p>Utility function for building an impulse response\nbased on the module parameters.</p>\n","access":"private","tagname":"","class":"p5.Reverb","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7394,"description":"<p>Internally, the p5.Convolver uses the a\n<a href=\"http://www.w3.org/TR/webaudio/#ConvolverNode\">\nWeb Audio Convolver Node</a>.</p>\n","itemtype":"property","name":"convolverNode","type":"{Object} Web Audio Convolver Node","class":"p5.Convolver","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7424,"description":"<p>Create a p5.Convolver. Accepts a path to a soundfile \nthat will be used to generate an impulse response.</p>\n","itemtype":"method","name":"createConvolver","params":[{"name":"path","description":"<p>path to a sound file</p>\n","type":"String"},{"name":"callback","description":"<p>function to call if loading is successful.\n The object will be passed in as the argument\n to the callback function.</p>\n","type":"Function","optional":true},{"name":"errorCallback","description":"<p>function to call if loading is not successful.\n A custom error will be passed in as the argument\n to the callback function.</p>\n","type":"Function","optional":true}],"return":{"description":"","type":"p5.Convolver"},"example":["\n<div><code>\nvar cVerb, sound;\nfunction preload() {\n // We have both MP3 and OGG versions of all sound assets\n soundFormats('ogg', 'mp3');\n \n // Try replacing 'bx-spring' with other soundfiles like\n // 'concrete-tunnel' 'small-plate' 'drum' 'beatbox'\n cVerb = createConvolver('assets/bx-spring.mp3');\n\n // Try replacing 'Damscray_DancingTiger' with\n // 'beat', 'doorbell', lucky_dragons_-_power_melody'\n sound = loadSound('assets/Damscray_DancingTiger.mp3');\n}\n\nfunction setup() {\n // disconnect from master output...\n sound.disconnect();\n \n // ...and process with cVerb\n // so that we only hear the convolution\n cVerb.process(sound);\n \n sound.play();\n}\n</code></div>"],"class":"p5.Convolver","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7474,"description":"<p>Private method to load a buffer as an Impulse Response,\nassign it to the convolverNode, and add to the Array of .impulses.</p>\n","params":[{"name":"path","description":"","type":"String"},{"name":"callback","description":"","type":"Function"},{"name":"errorCallback","description":"","type":"Function"}],"access":"private","tagname":"","class":"p5.Convolver","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7540,"description":"<p>Connect a source to the reverb, and assign reverb parameters.</p>\n","itemtype":"method","name":"process","params":[{"name":"src","description":"<p>p5.sound / Web Audio object with a sound\n output.</p>\n","type":"Object"}],"example":["\n<div><code>\nvar cVerb, sound;\nfunction preload() {\n soundFormats('ogg', 'mp3');\n \n cVerb = createConvolver('assets/concrete-tunnel.mp3');\n\n sound = loadSound('assets/beat.mp3');\n}\n\nfunction setup() {\n // disconnect from master output...\n sound.disconnect();\n \n // ...and process with (i.e. connect to) cVerb\n // so that we only hear the convolution\n cVerb.process(sound);\n \n sound.play();\n}\n</code></div>"],"class":"p5.Convolver","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7572,"description":"<p>If you load multiple impulse files using the .addImpulse method,\nthey will be stored as Objects in this Array. Toggle between them\nwith the <code>toggleImpulse(id)</code> method.</p>\n","itemtype":"property","name":"impulses","type":"{Array} Array of Web Audio Buffers","class":"p5.Convolver","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7581,"description":"<p>Load and assign a new Impulse Response to the p5.Convolver.\nThe impulse is added to the <code>.impulses</code> array. Previous\nimpulses can be accessed with the <code>.toggleImpulse(id)</code>\nmethod.</p>\n","itemtype":"method","name":"addImpulse","params":[{"name":"path","description":"<p>path to a sound file</p>\n","type":"String"},{"name":"callback","description":"<p>function (optional)</p>\n","type":"Function"},{"name":"errorCallback","description":"<p>function (optional)</p>\n","type":"Function"}],"class":"p5.Convolver","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7599,"description":"<p>Similar to .addImpulse, except that the <code>.impulses</code>\nArray is reset to save memory. A new <code>.impulses</code>\narray is created with this impulse as the only item.</p>\n","itemtype":"method","name":"resetImpulse","params":[{"name":"path","description":"<p>path to a sound file</p>\n","type":"String"},{"name":"callback","description":"<p>function (optional)</p>\n","type":"Function"},{"name":"errorCallback","description":"<p>function (optional)</p>\n","type":"Function"}],"class":"p5.Convolver","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7617,"description":"<p>If you have used <code>.addImpulse()</code> to add multiple impulses\nto a p5.Convolver, then you can use this method to toggle between\nthe items in the <code>.impulses</code> Array. Accepts a parameter\nto identify which impulse you wish to use, identified either by its\noriginal filename (String) or by its position in the <code>.impulses\n</code> Array (Number).<br/>\nYou can access the objects in the .impulses Array directly. Each\nObject has two attributes: an <code>.audioBuffer</code> (type:\nWeb Audio <a href=\"\nhttp://webaudio.github.io/web-audio-api/#the-audiobuffer-interface\">\nAudioBuffer)</a> and a <code>.name</code>, a String that corresponds\nwith the original filename.</p>\n","itemtype":"method","name":"toggleImpulse","params":[{"name":"id","description":"<p>Identify the impulse by its original filename\n (String), or by its position in the\n <code>.impulses</code> Array (Number).</p>\n","type":"String|Number"}],"class":"p5.Convolver","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7666,"class":"p5.Convolver","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7691,"class":"p5.Convolver","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7910,"description":"<p>Set the global tempo, in beats per minute, for all\np5.Parts. This method will impact all active p5.Parts.</p>\n","params":[{"name":"BPM","description":"<p>Beats Per Minute</p>\n","type":"Number"},{"name":"rampTime","description":"<p>Seconds from now</p>\n","type":"Number"}],"class":"p5.Convolver","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":7997,"description":"<p>Array of values to pass into the callback\nat each step of the phrase. Depending on the callback\nfunction&#39;s requirements, these values may be numbers,\nstrings, or an object with multiple parameters.\nZero (0) indicates a rest.</p>\n","itemtype":"property","name":"sequence","type":"{Array}","class":"p5.Phrase","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8090,"description":"<p>Set the tempo of this part, in Beats Per Minute.</p>\n","itemtype":"method","name":"setBPM","params":[{"name":"BPM","description":"<p>Beats Per Minute</p>\n","type":"Number"},{"name":"rampTime","description":"<p>Seconds from now</p>\n","type":"Number","optional":true}],"class":"p5.Part","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8100,"description":"<p>Returns the Beats Per Minute of this currently part.</p>\n","itemtype":"method","name":"getBPM","return":{"description":"","type":"Number"},"class":"p5.Part","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8109,"description":"<p>Start playback of this part. It will play\nthrough all of its phrases at a speed\ndetermined by setBPM.</p>\n","itemtype":"method","name":"start","params":[{"name":"time","description":"<p>seconds from now</p>\n","type":"Number","optional":true}],"class":"p5.Part","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8125,"description":"<p>Loop playback of this part. It will begin\nlooping through all of its phrases at a speed\ndetermined by setBPM.</p>\n","itemtype":"method","name":"loop","params":[{"name":"time","description":"<p>seconds from now</p>\n","type":"Number","optional":true}],"class":"p5.Part","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8142,"description":"<p>Tell the part to stop looping.</p>\n","itemtype":"method","name":"noLoop","class":"p5.Part","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8154,"description":"<p>Stop the part and cue it to step 0.</p>\n","itemtype":"method","name":"stop","params":[{"name":"time","description":"<p>seconds from now</p>\n","type":"Number","optional":true}],"class":"p5.Part","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8164,"description":"<p>Pause the part. Playback will resume\nfrom the current step.</p>\n","itemtype":"method","name":"pause","params":[{"name":"time","description":"<p>seconds from now</p>\n","type":"Number"}],"class":"p5.Part","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8176,"description":"<p>Add a p5.Phrase to this Part.</p>\n","itemtype":"method","name":"addPhrase","params":[{"name":"phrase","description":"<p>reference to a p5.Phrase</p>\n","type":"p5.Phrase"}],"class":"p5.Part","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8197,"description":"<p>Remove a phrase from this part, based on the name it was\ngiven when it was created.</p>\n","itemtype":"method","name":"removePhrase","params":[{"name":"phraseName","description":"","type":"String"}],"class":"p5.Part","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8211,"description":"<p>Get a phrase from this part, based on the name it was\ngiven when it was created. Now you can modify its array.</p>\n","itemtype":"method","name":"getPhrase","params":[{"name":"phraseName","description":"","type":"String"}],"class":"p5.Part","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8225,"description":"<p>Get a phrase from this part, based on the name it was\ngiven when it was created. Now you can modify its array.</p>\n","itemtype":"method","name":"replaceSequence","params":[{"name":"phraseName","description":"","type":"String"},{"name":"sequence","description":"<p>Array of values to pass into the callback\n at each step of the phrase.</p>\n","type":"Array"}],"class":"p5.Part","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8253,"description":"<p>Fire a callback function at every step.</p>\n","itemtype":"method","name":"onStep","params":[{"name":"callback","description":"<p>The name of the callback\n you want to fire\n on every beat/tatum.</p>\n","type":"Function"}],"class":"p5.Part","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8305,"description":"<p>Start playback of the score.</p>\n","itemtype":"method","name":"start","class":"p5.Score","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8314,"description":"<p>Stop playback of the score.</p>\n","itemtype":"method","name":"stop","class":"p5.Score","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8324,"description":"<p>Pause playback of the score.</p>\n","itemtype":"method","name":"pause","class":"p5.Score","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8332,"description":"<p>Loop playback of the score.</p>\n","itemtype":"method","name":"loop","class":"p5.Score","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8341,"description":"<p>Stop looping playback of the score. If it\nis currently playing, this will go into effect\nafter the current round of playback completes.</p>\n","itemtype":"method","name":"noLoop","class":"p5.Score","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8363,"description":"<p>Set the tempo for all parts in the score</p>\n","params":[{"name":"BPM","description":"<p>Beats Per Minute</p>\n","type":"Number"},{"name":"rampTime","description":"<p>Seconds from now</p>\n","type":"Number"}],"class":"p5.Score","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8469,"description":"<p>callback invoked when the recording is over</p>\n","access":"private","tagname":"","type":"{function(Float32Array)}","class":"p5.SoundRecorder","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8482,"description":"<p>Connect a specific device to the p5.SoundRecorder.\nIf no parameter is given, p5.SoundRecorer will record\nall audible p5.sound from your sketch.</p>\n","itemtype":"method","name":"setInput","params":[{"name":"unit","description":"<p>p5.sound object or a web audio unit\n that outputs sound</p>\n","type":"Object","optional":true}],"class":"p5.SoundRecorder","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8503,"description":"<p>Start recording. To access the recording, provide\na p5.SoundFile as the first parameter. The p5.SoundRecorder\nwill send its recording to that p5.SoundFile for playback once\nrecording is complete. Optional parameters include duration\n(in seconds) of the recording, and a callback function that\nwill be called once the complete recording has been\ntransfered to the p5.SoundFile.</p>\n","itemtype":"method","name":"record","params":[{"name":"soundFile","description":"<p>p5.SoundFile</p>\n","type":"p5.SoundFile"},{"name":"duration","description":"<p>Time (in seconds)</p>\n","type":"Number","optional":true},{"name":"callback","description":"<p>The name of a function that will be\n called once the recording completes</p>\n","type":"Function","optional":true}],"class":"p5.SoundRecorder","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8536,"description":"<p>Stop the recording. Once the recording is stopped,\nthe results will be sent to the p5.SoundFile that\nwas given on .record(), and if a callback function\nwas provided on record, that function will be called.</p>\n","itemtype":"method","name":"stop","class":"p5.SoundRecorder","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8555,"description":"<p>internal method called on audio process</p>\n","access":"private","tagname":"","params":[{"name":"event","description":"","type":"AudioProcessorEvent"}],"class":"p5.SoundRecorder","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8609,"description":"<p>Save a p5.SoundFile as a .wav audio file.</p>\n","itemtype":"method","name":"saveSound","params":[{"name":"soundFile","description":"<p>p5.SoundFile that you wish to save</p>\n","type":"p5.SoundFile"},{"name":"name","description":"<p>name of the resulting .wav file.</p>\n","type":"String"}],"class":"p5.SoundRecorder","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8781,"description":"<p>isDetected is set to true when a peak is detected.</p>\n","itemtype":"attribute","name":"isDetected","type":"{Boolean}","default":"false","class":"p5.PeakDetect","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8795,"description":"<p>The update method is run in the draw loop.</p>\n<p>Accepts an FFT object. You must call .analyze()\non the FFT object prior to updating the peakDetect\nbecause it relies on a completed FFT analysis.</p>\n","itemtype":"method","name":"update","params":[{"name":"fftObject","description":"<p>A p5.FFT object</p>\n","type":"p5.FFT"}],"class":"p5.PeakDetect","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8826,"description":"<p>onPeak accepts two arguments: a function to call when\na peak is detected. The value of the peak,\nbetween 0.0 and 1.0, is passed to the callback.</p>\n","itemtype":"method","name":"onPeak","params":[{"name":"callback","description":"<p>Name of a function that will\n be called when a peak is\n detected.</p>\n","type":"Function"},{"name":"val","description":"<p>Optional value to pass\n into the function when\n a peak is detected.</p>\n","type":"Object","optional":true}],"example":["\n<div><code>\nvar cnv, soundFile, fft, peakDetect;\nvar ellipseWidth = 0;\n\nfunction setup() {\n cnv = createCanvas(100,100);\n textAlign(CENTER);\n\n soundFile = loadSound('assets/beat.mp3');\n fft = new p5.FFT();\n peakDetect = new p5.PeakDetect();\n\n setupSound();\n\n // when a beat is detected, call triggerBeat()\n peakDetect.onPeak(triggerBeat);\n}\n\nfunction draw() {\n background(0);\n fill(255);\n text('click to play', width/2, height/2);\n\n fft.analyze();\n peakDetect.update(fft);\n\n ellipseWidth *= 0.95;\n ellipse(width/2, height/2, ellipseWidth, ellipseWidth);\n}\n\n// this function is called by peakDetect.onPeak\nfunction triggerBeat() {\n ellipseWidth = 50;\n}\n\n// mouseclick starts/stops sound\nfunction setupSound() {\n cnv.mouseClicked( function() {\n if (soundFile.isPlaying() ) {\n soundFile.stop();\n } else {\n soundFile.play();\n }\n });\n}\n</code></div>"],"class":"p5.PeakDetect","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8972,"description":"<p>Connect a source to the gain node.</p>\n","itemtype":"method","name":"setInput","params":[{"name":"src","description":"<p>p5.sound / Web Audio object with a sound\n output.</p>\n","type":"Object"}],"class":"p5.Gain","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8982,"description":"<p>Send output to a p5.sound or web audio object</p>\n","itemtype":"method","name":"connect","params":[{"name":"unit","description":"","type":"Object"}],"class":"p5.Gain","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":8992,"description":"<p>Disconnect all output.</p>\n","itemtype":"method","name":"disconnect","class":"p5.Gain","module":"p5.sound","submodule":"p5.sound"},{"file":"lib/addons/p5.sound.js","line":9000,"description":"<p>Set the output level of the gain node.</p>\n","itemtype":"method","name":"amp","params":[{"name":"volume","description":"<p>amplitude between 0 and 1.0</p>\n","type":"Number"},{"name":"rampTime","description":"<p>create a fade that lasts rampTime</p>\n","type":"Number","optional":true},{"name":"timeFromNow","description":"<p>schedule this event to happen\n seconds from now</p>\n","type":"Number","optional":true}],"class":"p5.Gain","module":"p5.sound","submodule":"p5.sound"}],"warnings":[{"message":"unknown tag: alt","line":" src/color/creating_reading.js:95"},{"message":"replacing incorrect tag: returns with return","line":" src/core/environment.js:431"},{"message":"replacing incorrect tag: returns with return","line":" src/core/environment.js:472"},{"message":"param name missing: {Invert}","line":" src/image/filters.js:240"},{"message":"replacing incorrect tag: returns with return","line":" src/image/loading_displaying.js:104"},{"message":"param name missing: {p5.Vector | Array }\n vector to scale by","line":" src/webgl/p5.Matrix.js:439"},{"message":"replacing incorrect tag: params with param","line":" lib/addons/p5.sound.js:1573"},{"message":"replacing incorrect tag: returns with return","line":" lib/addons/p5.sound.js:1573"},{"message":"param name missing: {String}","line":" lib/addons/p5.sound.js:6765"},{"message":"Missing item type\nmodule Conversion\nsubmodule Color Conversion","line":" src/color/color_conversion.js:1"},{"message":"Missing item type\nConversions adapted from <http://www.easyrgb.com/math.html>.\n\nIn these functions, hue is always in the range [0,1); all other components\nare in the range [0,1]. 'Brightness' and 'value' are used interchangeably.","line":" src/color/color_conversion.js:10"},{"message":"Missing item type\nConvert an HSBA array to HSLA.","line":" src/color/color_conversion.js:20"},{"message":"Missing item type\nConvert an HSBA array to RGBA.","line":" src/color/color_conversion.js:46"},{"message":"Missing item type\nConvert an HSLA array to HSBA.","line":" src/color/color_conversion.js:95"},{"message":"Missing item type\nConvert an HSLA array to RGBA.\n\nWe need to change basis from HSLA to something that can be more easily be\nprojected onto RGBA. We will choose hue and brightness as our first two\ncomponents, and pick a convenient third one ('zest') so that we don't need\nto calculate formal HSBA saturation.","line":" src/color/color_conversion.js:118"},{"message":"Missing item type\nConvert an RGBA array to HSBA.","line":" src/color/color_conversion.js:176"},{"message":"Missing item type\nConvert an RGBA array to HSLA.","line":" src/color/color_conversion.js:211"},{"message":"Missing item type\nHue is the same in HSB and HSL, but the maximum value may be different.\nThis function will return the HSB-normalized saturation when supplied with\nan HSB color object, but will default to the HSL-normalized saturation\notherwise.","line":" src/color/p5.Color.js:79"},{"message":"Missing item type\nSaturation is scaled differently in HSB and HSL. This function will return\nthe HSB saturation when supplied with an HSB color object, but will default\nto the HSL saturation otherwise.","line":" src/color/p5.Color.js:110"},{"message":"Missing item type\nCSS named colors.","line":" src/color/p5.Color.js:129"},{"message":"Missing item type\nThese regular expressions are used to build up the patterns for matching\nviable CSS color strings: fragmenting the regexes in this way increases the\nlegibility and comprehensibility of the code.\n\nNote that RGB values of .9 are not parsed by IE, but are supported here for\ncolor string consistency.","line":" src/color/p5.Color.js:282"},{"message":"Missing item type\nFull color string patterns. The capture groups are necessary.","line":" src/color/p5.Color.js:295"},{"message":"Missing item type\nFor a number of different inputs, returns a color formatted as [r, g, b, a]\narrays, with each component normalized between 0 and 1.","line":" src/color/p5.Color.js:402"},{"message":"Missing item type\nFor 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.","line":" src/color/p5.Color.js:572"},{"message":"Missing item type","line":" src/core/canvas.js:1"},{"message":"Missing item type\nThis is the p5 instance constructor.\n\nA p5 instance holds all the properties and methods related to\na p5 sketch. It expects an incoming sketch closure and it can also\ntake an optional node parameter for attaching the generated p5 canvas\nto a node. The sketch closure takes the newly created p5 instance as\nits sole argument and may optionally set preload(), setup(), and/or\ndraw() properties on it for running a sketch.\n\nA 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","line":" src/core/core.js:15"},{"message":"Missing item type\nSets the resolution at which Beziers display.\n\nThe default value is 20.","line":" src/core/curves.js:106"},{"message":"Missing item type\nSets the resolution at which curves display.\n\nThe default value is 20.","line":" src/core/curves.js:344"},{"message":"Missing item type\nReturns the current framerate.","line":" src/core/environment.js:229"},{"message":"Missing item type\nSpecifies the number of frames to be displayed every second. For example,\nthe function call frameRate(30) will attempt to refresh 30 times a second.\nIf the processor is not fast enough to maintain the specified rate, the\nframe rate will not be achieved. Setting the frame rate within setup() is\nrecommended. The default rate is 60 frames per second.\n\nCalling frameRate() with no arguments returns the current framerate.","line":" src/core/environment.js:238"},{"message":"Missing item type","line":" src/core/error_helpers.js:1"},{"message":"Missing item type\nChecks the definition type against the argument type\nIf any of these passes (in order), it matches:\n\n- p5.* definitions are checked with instanceof\n- Booleans are let through (everything is truthy or falsey)\n- Lowercase of the definition is checked against the js type\n- Number types are checked to see if they are numerically castable","line":" src/core/error_helpers.js:39"},{"message":"Missing item type\nPrints out a fancy, colorful message to the console log","line":" src/core/error_helpers.js:59"},{"message":"Missing item type\nValidate all the parameters of a function for number and type\nNOTE THIS FUNCTION IS TEMPORARILY DISABLED UNTIL FURTHER WORK\nAND UPDATES ARE IMPLEMENTED. -LMCCART","line":" src/core/error_helpers.js:106"},{"message":"Missing item type\nPrints out all the colors in the color pallete with white text.\nFor color blindness testing.","line":" src/core/error_helpers.js:244"},{"message":"Missing item type\nHelper fxn for sharing pixel methods","line":" src/core/p5.Element.js:811"},{"message":"Missing item type\nResize our canvas element.","line":" src/core/p5.Renderer.js:71"},{"message":"Missing item type\nHelper fxn to check font type (system or otf)","line":" src/core/p5.Renderer.js:145"},{"message":"Missing item type\nHelper fxn to measure ascent and descent.\nAdapted from http://stackoverflow.com/a/25355178","line":" src/core/p5.Renderer.js:201"},{"message":"Missing item type\np5.Renderer2D\nThe 2D graphics canvas renderer class.\nextends p5.Renderer","line":" src/core/p5.Renderer2D.js:9"},{"message":"Missing item type\nGenerate a cubic Bezier representing an arc on the unit circle of total\nangle `size` radians, beginning `start` radians above the x-axis. Up to\nfour of these curves are combined to make a full arc.\n\nSee www.joecridge.me/bezier.pdf for an explanation of the method.","line":" src/core/p5.Renderer2D.js:356"},{"message":"Missing item type\nshim for Uint8ClampedArray.slice\n(allows arrayCopy to work with pixels[])\nwith thanks to http://halfpapstudios.com/blog/tag/html5-canvas/\nEnumerable set to false to protect for...in from\nUint8ClampedArray.prototype pollution.","line":" src/core/shim.js:65"},{"message":"Missing item type\n_updatePAccelerations updates the pAcceleration values","line":" src/events/acceleration.js:72"},{"message":"Missing item type\nHolds the key codes of currently pressed keys.","line":" src/events/keyboard.js:12"},{"message":"Missing item type\nThe 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.","line":" src/events/keyboard.js:273"},{"message":"Missing item type\nThis module defines the filters for use with image buffers.\n\nThis module is basically a collection of functions stored in an object\nas opposed to modules. The functions are destructive, modifying\nthe passed in canvas rather than creating a copy.\n\nGenerally speaking users of this module will use the Filters.apply method\non a canvas to create an effect.\n\nA number of functions are borrowed/adapted from\nhttp://www.html5rocks.com/en/tutorials/canvas/imagefilters/\nor the java processing implementation.","line":" src/image/filters.js:3"},{"message":"Missing item type\nReturns the pixel buffer for a canvas","line":" src/image/filters.js:28"},{"message":"Missing item type\nReturns a 32 bit number containing ARGB data at ith pixel in the\n1D array containing pixels data.","line":" src/image/filters.js:51"},{"message":"Missing item type\nModifies pixels RGBA values to values contained in the data object.","line":" src/image/filters.js:70"},{"message":"Missing item type\nReturns the ImageData object for a canvas\nhttps://developer.mozilla.org/en-US/docs/Web/API/ImageData","line":" src/image/filters.js:90"},{"message":"Missing item type\nReturns a blank ImageData object.","line":" src/image/filters.js:113"},{"message":"Missing item type\nApplys a filter function to a canvas.\n\nThe difference between this and the actual filter functions defined below\nis that the filter functions generally modify the pixel buffer but do\nnot actually put that data back to the canvas (where it would actually\nupdate what is visible). By contrast this method does make the changes\nactually visible in the canvas.\n\nThe apply method is the method that callers of this module would generally\nuse. It has been separated from the actual filters to support an advanced\nuse case of creating a filter chain that executes without actually updating\nthe canvas in between everystep.","line":" src/image/filters.js:129"},{"message":"Missing item type\nConverts the image to black and white pixels depending if they are above or\nbelow the threshold defined by the level parameter. The parameter must be\nbetween 0.0 (black) and 1.0 (white). If no level is specified, 0.5 is used.\n\nBorrowed from http://www.html5rocks.com/en/tutorials/canvas/imagefilters/","line":" src/image/filters.js:168"},{"message":"Missing item type\nConverts any colors in the image to grayscale equivalents.\nNo parameter is used.\n\nBorrowed from http://www.html5rocks.com/en/tutorials/canvas/imagefilters/","line":" src/image/filters.js:203"},{"message":"Missing item type\nSets the alpha channel to entirely opaque. No parameter is used.","line":" src/image/filters.js:225"},{"message":"Missing item type\nSets each pixel to its inverse value. No parameter is used.","line":" src/image/filters.js:240"},{"message":"Missing item type\nLimits each channel of the image to the number of colors specified as\nthe parameter. The parameter can be set to values between 2 and 255, but\nresults are most noticeable in the lower ranges.\n\nAdapted from java based processing implementation","line":" src/image/filters.js:256"},{"message":"Missing item type\nreduces the bright areas in an image","line":" src/image/filters.js:287"},{"message":"Missing item type\nincreases the bright areas in an image","line":" src/image/filters.js:368"},{"message":"Missing item type\nThis module defines the p5 methods for the p5.Image class\nfor drawing images to the main display canvas.","line":" src/image/image.js:8"},{"message":"Missing item type\nValidates clipping params. Per drawImage spec sWidth and sHight cannot be\nnegative or greater than image intrinsic width and height","line":" src/image/loading_displaying.js:104"},{"message":"Missing item type\nApply the current tint color to the input image, return the resulting\ncanvas.","line":" src/image/loading_displaying.js:325"},{"message":"Missing item type\nThis module defines the p5.Image class and P5 methods for\ndrawing images to the main display canvas.","line":" src/image/p5.Image.js:9"},{"message":"Missing item type\nHelper fxn for sharing pixel methods","line":" src/image/p5.Image.js:161"},{"message":"Missing item type\nChecks if we are in preload and returns the last arg which will be the\n_decrementPreload function if called from a loadX() function. Should\nonly be used in loadX() functions.","line":" src/io/files.js:16"},{"message":"Missing item type\nGenerate a blob of file data as a url to prepare for download.\nAccepts an array of data, a filename, and an extension (optional).\nThis is a private function because it does not do any formatting,\nbut it is used by saveStrings, saveJSON, saveTable etc.","line":" src/io/files.js:1348"},{"message":"Missing item type\nForces download. Accepts a url to filedata/blob, a filename,\nand an extension (optional).\nThis is a private function because it does not do any formatting,\nbut it is used by saveStrings, saveJSON, saveTable etc.","line":" src/io/files.js:1371"},{"message":"Missing item type\nReturns a file extension, or another string\nif the provided parameter has no extension.","line":" src/io/files.js:1407"},{"message":"Missing item type\nReturns true if the browser is Safari, false if not.\nSafari makes trouble for downloading files.","line":" src/io/files.js:1439"},{"message":"Missing item type\nHelper function, a callback for download that deletes\nan invisible anchor element from the DOM once the file\nhas been automatically downloaded.","line":" src/io/files.js:1451"},{"message":"Missing item type\nTable Options\n<p>Generic class for handling tabular data, typically from a\nCSV, TSV, or other sort of spreadsheet file.</p>\n<p>CSV files are\n<a href=\"http://en.wikipedia.org/wiki/Comma-separated_values\">\ncomma separated values</a>, often with the data in quotes. TSV\nfiles use tabs as separators, and usually don't bother with the\nquotes.</p>\n<p>File names should end with .csv if they're comma separated.</p>\n<p>A rough \"spec\" for CSV can be found\n<a href=\"http://tools.ietf.org/html/rfc4180\">here</a>.</p>\n<p>To load files, use the loadTable method.</p>\n<p>To save tables to your computer, use the save method\n or the saveTable method.</p>\n\nPossible options include:\n<ul>\n<li>csv - parse the table as comma-separated values\n<li>tsv - parse the table as tab-separated values\n<li>header - this table has a header (title) row\n</ul>","line":" src/io/p5.Table.js:12"},{"message":"Missing item type\nReturns the total number of columns in a Table.","line":" src/io/p5.Table.js:610"},{"message":"Missing item type\nThis method is called while the parsing of XML (when loadXML() is\ncalled). The difference between this method and the setContent()\nmethod defined later is that this one is used to set the content\nwhen the node in question has more nodes under it and so on and\nnot directly text content. While in the other one is used when\nthe node in question directly has text inside it.","line":" src/io/p5.XML.js:763"},{"message":"Missing item type\nThis method is called while the parsing of XML (when loadXML() is\ncalled). The XML node is passed and its attributes are stored in the\np5.XML's attribute Object.","line":" src/io/p5.XML.js:780"},{"message":"Missing item type\nAdds two vectors together and returns a new one.","line":" src/math/p5.Vector.js:870"},{"message":"Missing item type\nSubtracts one p5.Vector from another and returns a new one. The second\nvector (v2) is subtracted from the first (v1), resulting in v1-v2.","line":" src/math/p5.Vector.js:891"},{"message":"Missing item type\nMultiplies a vector by a scalar and returns a new vector.","line":" src/math/p5.Vector.js:913"},{"message":"Missing item type\nDivides a vector by a scalar and returns a new vector.","line":" src/math/p5.Vector.js:932"},{"message":"Missing item type\nCalculates the dot product of two vectors.","line":" src/math/p5.Vector.js:952"},{"message":"Missing item type\nCalculates the cross product of two vectors.","line":" src/math/p5.Vector.js:964"},{"message":"Missing item type\nCalculates the Euclidean distance between two points (considering a\npoint as a vector object).","line":" src/math/p5.Vector.js:976"},{"message":"Missing item type\nLinear interpolate a vector to another vector and return the result as a\nnew vector.","line":" src/math/p5.Vector.js:989"},{"message":"Missing item type","line":" src/math/p5.Vector.js:1038"},{"message":"Missing item type\nReturns the ascent of the current font at its current size. The ascent\nrepresents the distance, in pixels, of the tallest character above\nthe baseline.","line":" src/typography/attributes.js:157"},{"message":"Missing item type\nReturns the descent of the current font at its current size. The descent\nrepresents the distance, in pixels, of the character with the longest\ndescender below the baseline.","line":" src/typography/attributes.js:185"},{"message":"Missing item type\nHelper function to measure ascent and descent.","line":" src/typography/attributes.js:213"},{"message":"Missing item type\nComputes an array of points following the path for specified text","line":" src/typography/p5.Font.js:171"},{"message":"Missing item type\nReturns the set of opentype glyphs for the supplied string.\n\nNote that there is not a strict one-to-one mapping between characters\nand glyphs, so the list of returned glyphs can be larger or smaller\n than the length of the given string.","line":" src/typography/p5.Font.js:219"},{"message":"Missing item type\nReturns an opentype path for the supplied string and position.","line":" src/typography/p5.Font.js:234"},{"message":"Missing item type\nParse OBJ lines into model. For reference, this is what a simple model of a\nsquare might look like:\n\nv -0.5 -0.5 0.5\nv -0.5 -0.5 -0.5\nv -0.5 0.5 -0.5\nv -0.5 0.5 0.5\n\nf 4 3 2 1","line":" src/webgl/loading.js:87"},{"message":"Missing item type\nTexture Util functions","line":" src/webgl/material.js:161"},{"message":"Missing item type\nChecks whether val is a pot\nmore info on power of 2 here:\nhttps://www.opengl.org/wiki/NPOT_Texture","line":" src/webgl/material.js:182"},{"message":"Missing item type\nreturns the next highest power of 2 value","line":" src/webgl/material.js:193"},{"message":"Missing item type","line":" src/webgl/material.js:301"},{"message":"Missing item type\np5 Geometry class","line":" src/webgl/p5.Geometry.js:7"},{"message":"Missing item type\ncomputes smooth normals per vertex as an average of each\nface.","line":" src/webgl/p5.Geometry.js:71"},{"message":"Missing item type\nAverages the vertex normals. Used in curved\nsurfaces","line":" src/webgl/p5.Geometry.js:95"},{"message":"Missing item type\nAverages pole normals. Used in spherical primitives","line":" src/webgl/p5.Geometry.js:114"},{"message":"Missing item type\nModifies all vertices to be centered within the range -100 to 100.","line":" src/webgl/p5.Geometry.js:146"},{"message":"Missing item type","line":" src/webgl/p5.Matrix.js:1"},{"message":"Missing item type\nA class to describe a 4x4 matrix\nfor model and view matrix manipulation in the p5js webgl renderer.\nclass p5.Matrix","line":" src/webgl/p5.Matrix.js:19"},{"message":"Missing item type\nSets the x, y, and z component of the vector using two or three separate\nvariables, the data from a p5.Matrix, or the values from a float array.","line":" src/webgl/p5.Matrix.js:74"},{"message":"Missing item type\nGets a copy of the vector, returns a p5.Matrix object.","line":" src/webgl/p5.Matrix.js:93"},{"message":"Missing item type\nreturn a copy of a matrix","line":" src/webgl/p5.Matrix.js:102"},{"message":"Missing item type\nreturn an identity matrix","line":" src/webgl/p5.Matrix.js:127"},{"message":"Missing item type\ntranspose according to a given matrix","line":" src/webgl/p5.Matrix.js:135"},{"message":"Missing item type\ninvert matrix according to a give matrix","line":" src/webgl/p5.Matrix.js:195"},{"message":"Missing item type\nInverts a 3x3 matrix","line":" src/webgl/p5.Matrix.js:280"},{"message":"Missing item type\ntransposes a 3x3 p5.Matrix by a mat3","line":" src/webgl/p5.Matrix.js:316"},{"message":"Missing item type\nconverts a 4x4 matrix to its 3x3 inverse tranform\ncommonly used in MVMatrix to NMatrix conversions.","line":" src/webgl/p5.Matrix.js:332"},{"message":"Missing item type\ninspired by Toji's mat4 determinant","line":" src/webgl/p5.Matrix.js:360"},{"message":"Missing item type\nmultiply two mat4s","line":" src/webgl/p5.Matrix.js:383"},{"message":"Missing item type\nscales a p5.Matrix by scalars or a vector","line":" src/webgl/p5.Matrix.js:439"},{"message":"Missing item type\nrotate our Matrix around an axis by the given angle.","line":" src/webgl/p5.Matrix.js:485"},{"message":"Missing item type","line":" src/webgl/p5.Matrix.js:564"},{"message":"Missing item type\nsets the perspective matrix","line":" src/webgl/p5.Matrix.js:594"},{"message":"Missing item type\nsets the ortho matrix","line":" src/webgl/p5.Matrix.js:628"},{"message":"Missing item type\nPRIVATE","line":" src/webgl/p5.Matrix.js:663"},{"message":"Missing item type\nWelcome to RendererGL Immediate Mode.\nImmediate mode is used for drawing custom shapes\nfrom a set of vertices. Immediate Mode is activated\nwhen you call beginShape() & de-activated when you call endShape().\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.","line":" src/webgl/p5.RendererGL.Immediate.js:1"},{"message":"Missing item type\nBegin shape drawing. This is a helpful way of generating\ncustom shapes quickly. However in WEBGL mode, application\nperformance will likely drop as a result of too many calls to\nbeginShape() / endShape(). As a high performance alternative,\nplease use p5.js geometry primitives.","line":" src/webgl/p5.RendererGL.Immediate.js:19"},{"message":"Missing item type\nadds a vertex to be drawn in a custom Shape.","line":" src/webgl/p5.RendererGL.Immediate.js:49"},{"message":"Missing item type\nEnd shape drawing and render vertices to screen.","line":" src/webgl/p5.RendererGL.Immediate.js:68"},{"message":"Missing item type\nBind immediateMode buffers to data,\nthen draw gl arrays","line":" src/webgl/p5.RendererGL.Immediate.js:121"},{"message":"Missing item type\ninitializes buffer defaults. runs each time a new geometry is\nregistered","line":" src/webgl/p5.RendererGL.Retained.js:7"},{"message":"Missing item type\ncreateBuffers description","line":" src/webgl/p5.RendererGL.Retained.js:30"},{"message":"Missing item type\nDraws buffers given a geometry key ID","line":" src/webgl/p5.RendererGL.Retained.js:93"},{"message":"Missing item type\nturn a two dimensional array into one dimensional array","line":" src/webgl/p5.RendererGL.Retained.js:129"},{"message":"Missing item type\nturn a p5.Vector Array into a one dimensional number array","line":" src/webgl/p5.RendererGL.Retained.js:145"},{"message":"Missing item type\nmodel view, projection, & normal\nmatrices","line":" src/webgl/p5.RendererGL.js:43"},{"message":"Missing item type\n[background description]","line":" src/webgl/p5.RendererGL.js:106"},{"message":"Missing item type\n[_initShaders description]","line":" src/webgl/p5.RendererGL.js:130"},{"message":"Missing item type\nSets a shader uniform given a shaderProgram and uniform string","line":" src/webgl/p5.RendererGL.js:205"},{"message":"Missing item type\n[strokeWeight description]","line":" src/webgl/p5.RendererGL.js:353"},{"message":"Missing item type\n[resize description]","line":" src/webgl/p5.RendererGL.js:376"},{"message":"Missing item type\nclears color and depth buffers\nwith r,g,b,a","line":" src/webgl/p5.RendererGL.js:393"},{"message":"Missing item type\n[translate description]","line":" src/webgl/p5.RendererGL.js:410"},{"message":"Missing item type\nScales the Model View Matrix by a vector","line":" src/webgl/p5.RendererGL.js:427"},{"message":"Missing item type\npushes a copy of the model view matrix onto the\nMV Matrix stack.","line":" src/webgl/p5.RendererGL.js:459"},{"message":"Missing item type\n[pop description]","line":" src/webgl/p5.RendererGL.js:467"},{"message":"Missing item type","line":" src/webgl/primitives.js:230"},{"message":"Missing item type\n_globalInit\n\nTODO: ???\nif sketch is on window\nassume \"global\" mode\nand instantiate p5 automatically\notherwise do nothing","line":" src/app.js:62"},{"message":"Missing item type\nHelper function for select and selectAll","line":" lib/addons/p5.dom.js:155"},{"message":"Missing item type\nHelper function for getElement and getElements.","line":" lib/addons/p5.dom.js:171"},{"message":"Missing item type\nHelpers for create methods.","line":" lib/addons/p5.dom.js:221"},{"message":"Missing item type","line":" lib/addons/p5.dom.js:365"},{"message":"Missing item type","line":" lib/addons/p5.dom.js:804"},{"message":"Missing item type","line":" lib/addons/p5.dom.js:867"},{"message":"Missing item type","line":" lib/addons/p5.dom.js:895"},{"message":"Missing item type\nCenters a p5 Element either vertically, horizontally,\nor both, relative to its parent or according to\nthe body if the Element has no parent. If no argument is passed\nthe Element is aligned both vertically and horizontally.","line":" lib/addons/p5.dom.js:1117"},{"message":"Missing item type","line":" lib/addons/p5.dom.js:1867"},{"message":"Missing item type","line":" lib/addons/p5.dom.js:1937"},{"message":"Missing item type","line":" lib/addons/p5.dom.js:1959"},{"message":"Missing item type\np5.sound developed by Jason Sigal for the Processing Foundation, Google Summer of Code 2014. The MIT License (MIT).\n\nhttp://github.com/therewasaguy/p5.sound\n\nSome of the many audio libraries & resources that inspire p5.sound:\n - TONE.js (c) Yotam Mann, 2014. Licensed under The MIT License (MIT). https://github.com/TONEnoTONE/Tone.js\n - buzz.js (c) Jay Salvat, 2013. Licensed under The MIT License (MIT). http://buzz.jaysalvat.com/\n - Boris Smus Web Audio API book, 2013. Licensed under the Apache License http://www.apache.org/licenses/LICENSE-2.0\n - wavesurfer.js https://github.com/katspaugh/wavesurfer.js\n - Web Audio Components by Jordan Santell https://github.com/web-audio-components\n - Wilm Thoben's Sound library for Processing https://github.com/processing/processing/tree/master/java/libraries/sound\n \n Web Audio API: http://w3.org/TR/webaudio/","line":" lib/addons/p5.sound.js:53"},{"message":"Missing item type\nDetermine which filetypes are supported (inspired by buzz.js)\nThe audio element (el) will only be used to test browser support for various audio formats","line":" lib/addons/p5.sound.js:221"},{"message":"Missing item type\nMaster contains AudioContext and the master sound output.","line":" lib/addons/p5.sound.js:288"},{"message":"Missing item type\na silent connection to the DesinationNode\nwhich will ensure that anything connected to it\nwill not be garbage collected","line":" lib/addons/p5.sound.js:386"},{"message":"Missing item type\nReturns the closest MIDI note value for\na given frequency.","line":" lib/addons/p5.sound.js:415"},{"message":"Missing item type\nUsed by Osc and Env to chain signal math","line":" lib/addons/p5.sound.js:575"},{"message":"Missing item type\nThis is a helper function that the p5.SoundFile calls to load\nitself. Accepts a callback (the name of another function)\nas an optional parameter.","line":" lib/addons/p5.sound.js:893"},{"message":"Missing item type\nSet a p5.SoundFile's looping flag to true or false. If the sound\nis currently playing, this change will take effect when it\nreaches the end of the current playback.","line":" lib/addons/p5.sound.js:1224"},{"message":"Missing item type\nReturns 'true' if a p5.SoundFile is currently looping and playing, 'false' if not.","line":" lib/addons/p5.sound.js:1244"},{"message":"Missing item type\nStop playback on all of this soundfile's sources.","line":" lib/addons/p5.sound.js:1302"},{"message":"Missing item type\nReturns the current stereo pan position (-1.0 to 1.0)","line":" lib/addons/p5.sound.js:1404"},{"message":"Missing item type","line":" lib/addons/p5.sound.js:1743"},{"message":"Missing item type\nReplace the current Audio Buffer with a new Buffer.","line":" lib/addons/p5.sound.js:1761"},{"message":"Missing item type","line":" lib/addons/p5.sound.js:2027"},{"message":"Missing item type","line":" lib/addons/p5.sound.js:2911"},{"message":"Missing item type","line":" lib/addons/p5.sound.js:3314"},{"message":"Missing item type","line":" lib/addons/p5.sound.js:3335"},{"message":"Missing item type","line":" lib/addons/p5.sound.js:3394"},{"message":"Missing item type","line":" lib/addons/p5.sound.js:3847"},{"message":"Missing item type","line":" lib/addons/p5.sound.js:3984"},{"message":"Missing item type","line":" lib/addons/p5.sound.js:4017"},{"message":"Missing item type","line":" lib/addons/p5.sound.js:4063"},{"message":"Missing item type","line":" lib/addons/p5.sound.js:4084"},{"message":"Missing item type","line":" lib/addons/p5.sound.js:4104"},{"message":"Missing item type\nConnect a p5.sound object or Web Audio node to this\np5.Signal so that its amplitude values can be scaled.","line":" lib/addons/p5.sound.js:4217"},{"message":"Missing item type","line":" lib/addons/p5.sound.js:4806"},{"message":"Missing item type","line":" lib/addons/p5.sound.js:4992"},{"message":"Missing item type\nSet the amplitude of the noise between 0 and 1.0. Or,\nmodulate amplitude with an audio signal such as an oscillator.","line":" lib/addons/p5.sound.js:6234"},{"message":"Missing item type\nAdd input sources to the list of available sources.","line":" lib/addons/p5.sound.js:6460"},{"message":"Missing item type\nInspired by Simple Reverb by Jordan Santell\nhttps://github.com/web-audio-components/simple-reverb/blob/master/index.js\n \nUtility function for building an impulse response\nbased on the module parameters.","line":" lib/addons/p5.sound.js:7296"},{"message":"Missing item type\nPrivate method to load a buffer as an Impulse Response,\nassign it to the convolverNode, and add to the Array of .impulses.","line":" lib/addons/p5.sound.js:7474"},{"message":"Missing item type","line":" lib/addons/p5.sound.js:7666"},{"message":"Missing item type","line":" lib/addons/p5.sound.js:7691"},{"message":"Missing item type\nSet the global tempo, in beats per minute, for all\np5.Parts. This method will impact all active p5.Parts.","line":" lib/addons/p5.sound.js:7910"},{"message":"Missing item type\nSet the tempo for all parts in the score","line":" lib/addons/p5.sound.js:8363"},{"message":"Missing item type\ncallback invoked when the recording is over","line":" lib/addons/p5.sound.js:8469"},{"message":"Missing item type\ninternal method called on audio process","line":" lib/addons/p5.sound.js:8555"}]}